summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-oe/recipes-support/opencv
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-support/opencv')
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch38
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch26
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch127
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-carotene-don-t-use-__asm__-with-aarch64.patch1250
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Do-not-enable-asm-with-clang.patch993
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Make-opencv-ts-create-share-library-intead-of-static.patch26
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-imgcodecs-refactoring-improve-code-quality.patch656
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch80
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-imgproc-test-add-checks-for-remove-call.patch186
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/CVE-2017-14136.patch288
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/already-exists.patch394
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/fixpkgconfig.patch29
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/javagen.patch16
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/protobuf.patch57
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/tinydnn.patch34
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv/uselocalxfeatures.patch20
-rw-r--r--meta-openembedded/meta-oe/recipes-support/opencv/opencv_3.3.bb203
17 files changed, 4423 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch
new file mode 100644
index 000000000..4d76ad40c
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch
@@ -0,0 +1,38 @@
+From 4801a057730632225337d7f6d26b9335e6b9b078 Mon Sep 17 00:00:00 2001
+From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+Date: Thu, 31 Mar 2016 00:20:15 +0200
+Subject: [PATCH] 3rdparty/ippicv: Use pre-downloaded ipp
+
+Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
+---
+ 3rdparty/ippicv/ippicv.cmake | 15 +--------------
+ 1 file changed, 1 insertion(+), 14 deletions(-)
+
+diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake
+index d601da4bb..f6fc1098c 100644
+--- a/3rdparty/ippicv/ippicv.cmake
++++ b/3rdparty/ippicv/ippicv.cmake
+@@ -39,18 +39,5 @@ function(download_ippicv root_var)
+ endif()
+
+ set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/ippicv")
+- ocv_download(FILENAME ${OPENCV_ICV_NAME}
+- HASH ${OPENCV_ICV_HASH}
+- URL
+- "${OPENCV_IPPICV_URL}"
+- "$ENV{OPENCV_IPPICV_URL}"
+- "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"
+- DESTINATION_DIR "${THE_ROOT}"
+- ID IPPICV
+- STATUS res
+- UNPACK RELATIVE_URL)
+-
+- if(res)
+- set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
+- endif()
++ set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
+ endfunction()
+--
+2.13.4
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch
new file mode 100644
index 000000000..6dd48fcdc
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch
@@ -0,0 +1,26 @@
+From 2bc6bb9831d07f035fea74ea745cea43dd5f9ef9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 9 Sep 2017 23:48:31 -0700
+Subject: [PATCH] Dont use isystem
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ cmake/OpenCVPCHSupport.cmake | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+Index: git/cmake/OpenCVPCHSupport.cmake
+===================================================================
+--- git.orig/cmake/OpenCVPCHSupport.cmake
++++ git/cmake/OpenCVPCHSupport.cmake
+@@ -17,7 +17,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
+ IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2.0")
+ SET(PCHSupport_FOUND TRUE)
+ ENDIF()
+-
++ SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-I")
++ SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-I")
+ SET(_PCH_include_prefix "-I")
+ SET(_PCH_isystem_prefix "-isystem")
+ SET(_PCH_define_prefix "-D")
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch
new file mode 100644
index 000000000..0140633db
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch
@@ -0,0 +1,127 @@
+Upstream-Status: Backport [https://github.com/opencv/opencv/pull/9376/commits/0d854db361106dfcb055231fd0112c5b85ef2287]
+
+Fix CVEs for opencv 3.3.
+
+* CVE-2017-12597
+* CVE-2017-12598
+* CVE-2017-12599
+* CVE-2017-12600
+* CVE-2017-12601
+* CVE-2017-12602
+* CVE-2017-12603
+* CVE-2017-12604
+* CVE-2017-12605
+* CVE-2017-12606
+* CVE-2017-12862
+* CVE-2017-12863
+* CVE-2017-12864
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+From 0d854db361106dfcb055231fd0112c5b85ef2287 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
+Date: Tue, 15 Aug 2017 21:45:05 +0000
+Subject: [PATCH 1/3] build: workaround GCC 7.1.1 compilation issue with
+ sanitize flags
+
+Version: gcc (GCC) 7.1.1 20170622 (Red Hat 7.1.1-3)
+Flags: -fsanitize=address,undefined
+---
+ modules/ts/src/cuda_test.cpp | 56 ++++++++++++++++++++++++++------------------
+ 1 file changed, 33 insertions(+), 23 deletions(-)
+
+diff --git a/modules/ts/src/cuda_test.cpp b/modules/ts/src/cuda_test.cpp
+index a48e0a087..eb4cee136 100644
+--- a/modules/ts/src/cuda_test.cpp
++++ b/modules/ts/src/cuda_test.cpp
+@@ -322,16 +322,20 @@ namespace cvtest
+
+ if (m1.size() != m2.size())
+ {
+- return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
+- << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
+- << expr2 << "\" [" << PrintToString(m2.size()) << "]";
++ std::stringstream msg;
++ msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
++ << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
++ << expr2 << "\" [" << PrintToString(m2.size()) << "]";
++ return AssertionFailure() << msg.str();
+ }
+
+ if (m1.type() != m2.type())
+ {
+- return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
+- << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
+- << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
++ std::stringstream msg;
++ msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
++ << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
++ << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
++ return AssertionFailure() << msg.str();
+ }
+
+ Mat diff;
+@@ -343,12 +347,14 @@ namespace cvtest
+
+ if (maxVal > eps)
+ {
+- return AssertionFailure() << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
+- << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
+- << ", which exceeds \"" << eps_expr << "\", where \""
+- << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
+- << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
+- << eps_expr << "\" evaluates to " << eps;
++ std::stringstream msg;
++ msg << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
++ << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
++ << ", which exceeds \"" << eps_expr << "\", where \""
++ << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
++ << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
++ << eps_expr << "\" evaluates to " << eps;
++ return AssertionFailure() << msg.str();
+ }
+
+ return AssertionSuccess();
+@@ -469,9 +475,11 @@ namespace cvtest
+ {
+ if (gold.size() != actual.size())
+ {
+- return testing::AssertionFailure() << "KeyPoints size mistmach\n"
+- << "\"" << gold_expr << "\" : " << gold.size() << "\n"
+- << "\"" << actual_expr << "\" : " << actual.size();
++ std::stringstream msg;
++ msg << "KeyPoints size mistmach\n"
++ << "\"" << gold_expr << "\" : " << gold.size() << "\n"
++ << "\"" << actual_expr << "\" : " << actual.size();
++ return AssertionFailure() << msg.str();
+ }
+
+ std::sort(actual.begin(), actual.end(), KeyPointLess());
+@@ -484,14 +492,16 @@ namespace cvtest
+
+ if (!keyPointsEquals(p1, p2))
+ {
+- return testing::AssertionFailure() << "KeyPoints differ at " << i << "\n"
+- << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
+- << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
+- << "size : " << p1.size << " vs " << p2.size << "\n"
+- << "angle : " << p1.angle << " vs " << p2.angle << "\n"
+- << "response : " << p1.response << " vs " << p2.response << "\n"
+- << "octave : " << p1.octave << " vs " << p2.octave << "\n"
+- << "class_id : " << p1.class_id << " vs " << p2.class_id;
++ std::stringstream msg;
++ msg << "KeyPoints differ at " << i << "\n"
++ << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
++ << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
++ << "size : " << p1.size << " vs " << p2.size << "\n"
++ << "angle : " << p1.angle << " vs " << p2.angle << "\n"
++ << "response : " << p1.response << " vs " << p2.response << "\n"
++ << "octave : " << p1.octave << " vs " << p2.octave << "\n"
++ << "class_id : " << p1.class_id << " vs " << p2.class_id;
++ return AssertionFailure() << msg.str();
+ }
+ }
+
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-carotene-don-t-use-__asm__-with-aarch64.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-carotene-don-t-use-__asm__-with-aarch64.patch
new file mode 100644
index 000000000..a1a56e0e4
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-carotene-don-t-use-__asm__-with-aarch64.patch
@@ -0,0 +1,1250 @@
+From 353fc92618ce0dc6bab4a3e8bff1c13c3b613110 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@intel.com>
+Date: Wed, 23 Aug 2017 17:41:23 +0300
+Subject: [PATCH 1/2] carotene: don't use __asm__ with aarch64
+
+---
+Upstream-Status: Backport
+
+ 3rdparty/carotene/src/channel_extract.cpp | 4 +-
+ 3rdparty/carotene/src/channels_combine.cpp | 2 +-
+ 3rdparty/carotene/src/colorconvert.cpp | 104 ++++++++++++++---------------
+ 3rdparty/carotene/src/convert.cpp | 54 +++++++--------
+ 3rdparty/carotene/src/convert_scale.cpp | 72 ++++++++++----------
+ 3rdparty/carotene/src/gaussian_blur.cpp | 6 +-
+ 3rdparty/carotene/src/pyramid.cpp | 20 +++---
+ 3rdparty/carotene/src/scharr.cpp | 4 +-
+ 8 files changed, 133 insertions(+), 133 deletions(-)
+
+diff --git a/3rdparty/carotene/src/channel_extract.cpp b/3rdparty/carotene/src/channel_extract.cpp
+index f663bc6005..8238a3ece8 100644
+--- a/3rdparty/carotene/src/channel_extract.cpp
++++ b/3rdparty/carotene/src/channel_extract.cpp
+@@ -231,7 +231,7 @@ void extract4(const Size2D &size,
+ srcStride == dst2Stride && \
+ srcStride == dst3Stride &&
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+
+ #define SPLIT_ASM2(sgn, bits) __asm__ ( \
+ "vld2." #bits " {d0, d2}, [%[in0]] \n\t" \
+@@ -351,7 +351,7 @@ void extract4(const Size2D &size,
+ } \
+ }
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+
+ #define ALPHA_QUAD(sgn, bits) { \
+ internal::prefetch(src + sj); \
+diff --git a/3rdparty/carotene/src/channels_combine.cpp b/3rdparty/carotene/src/channels_combine.cpp
+index 157c8b8121..fc98fb9181 100644
+--- a/3rdparty/carotene/src/channels_combine.cpp
++++ b/3rdparty/carotene/src/channels_combine.cpp
+@@ -77,7 +77,7 @@ namespace CAROTENE_NS {
+ dstStride == src2Stride && \
+ dstStride == src3Stride &&
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+
+ #define MERGE_ASM2(sgn, bits) __asm__ ( \
+ "vld1." #bits " {d0-d1}, [%[in0]] \n\t" \
+diff --git a/3rdparty/carotene/src/colorconvert.cpp b/3rdparty/carotene/src/colorconvert.cpp
+index 3037fe672a..26ae54b15c 100644
+--- a/3rdparty/carotene/src/colorconvert.cpp
++++ b/3rdparty/carotene/src/colorconvert.cpp
+@@ -97,7 +97,7 @@ void rgb2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -116,7 +116,7 @@ void rgb2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ for (; dj < roiw8; sj += 24, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -198,7 +198,7 @@ void rgbx2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -217,7 +217,7 @@ void rgbx2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ for (; dj < roiw8; sj += 32, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -300,7 +300,7 @@ void bgr2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -319,7 +319,7 @@ void bgr2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ for (; dj < roiw8; sj += 24, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -402,7 +402,7 @@ void bgrx2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -421,7 +421,7 @@ void bgrx2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ for (; dj < roiw8; sj += 32, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -512,7 +512,7 @@ void gray2rgb(const Size2D &size,
+ for (; sj < roiw16; sj += 16, dj += 48)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld1.8 {d0-d1}, [%[in0]] \n\t"
+ "vmov.8 q1, q0 \n\t"
+@@ -538,7 +538,7 @@ void gray2rgb(const Size2D &size,
+
+ if (sj < roiw8)
+ {
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld1.8 {d0}, [%[in]] \n\t"
+ "vmov.8 d1, d0 \n\t"
+@@ -584,7 +584,7 @@ void gray2rgbx(const Size2D &size,
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register uint8x16_t vc255 asm ("q4") = vmovq_n_u8(255);
+ #else
+ uint8x16x4_t vRgba;
+@@ -602,7 +602,7 @@ void gray2rgbx(const Size2D &size,
+ for (; sj < roiw16; sj += 16, dj += 64)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld1.8 {d0-d1}, [%[in0]] \n\t"
+ "vmov.8 q1, q0 \n\t"
+@@ -628,7 +628,7 @@ void gray2rgbx(const Size2D &size,
+
+ if (sj < roiw8)
+ {
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld1.8 {d5}, [%[in]] \n\t"
+ "vmov.8 d6, d5 \n\t"
+@@ -672,7 +672,7 @@ void rgb2rgbx(const Size2D &size,
+ internal::assertSupportedConfiguration();
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ register uint8x8_t vc255_0 asm ("d3") = vmov_n_u8(255);
+ #else
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+@@ -688,7 +688,7 @@ void rgb2rgbx(const Size2D &size,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u, j = 0u;
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ for (; j < roiw8; sj += 24, dj += 32, j += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -742,7 +742,7 @@ void rgbx2rgb(const Size2D &size,
+ internal::assertSupportedConfiguration();
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+-#if !defined(__GNUC__) || !defined(__arm__)
++#if !(!defined(__aarch64__) && defined(__GNUC__) && defined(__arm__))
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+ union { uint8x16x4_t v4; uint8x16x3_t v3; } v_dst0;
+ union { uint8x8x4_t v4; uint8x8x3_t v3; } v_dst;
+@@ -754,7 +754,7 @@ void rgbx2rgb(const Size2D &size,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u, j = 0u;
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -805,7 +805,7 @@ void rgb2bgr(const Size2D &size,
+ {
+ internal::assertSupportedConfiguration();
+ #ifdef CAROTENE_NEON
+-#if !defined(__GNUC__) || !defined(__arm__)
++#if !(!defined(__aarch64__) && defined(__GNUC__) && defined(__arm__))
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+ #endif
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+@@ -817,7 +817,7 @@ void rgb2bgr(const Size2D &size,
+ size_t sj = 0u, dj = 0u, j = 0u;
+
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -874,7 +874,7 @@ void rgbx2bgrx(const Size2D &size,
+ {
+ internal::assertSupportedConfiguration();
+ #ifdef CAROTENE_NEON
+-#if !defined(__GNUC__) || !defined(__arm__)
++#if !(!defined(__aarch64__) && defined(__GNUC__) && defined(__arm__))
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+ #endif
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+@@ -885,7 +885,7 @@ void rgbx2bgrx(const Size2D &size,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u, j = 0u;
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ for (; j < roiw8; sj += 32, dj += 32, j += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -943,7 +943,7 @@ void rgbx2bgr(const Size2D &size,
+ {
+ internal::assertSupportedConfiguration();
+ #ifdef CAROTENE_NEON
+-#if !defined(__GNUC__) || !defined(__arm__)
++#if !(!defined(__aarch64__) && defined(__GNUC__) && defined(__arm__))
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+ #endif
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+@@ -954,7 +954,7 @@ void rgbx2bgr(const Size2D &size,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u, j = 0u;
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -1010,7 +1010,7 @@ void rgb2bgrx(const Size2D &size,
+ {
+ internal::assertSupportedConfiguration();
+ #ifdef CAROTENE_NEON
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ register uint8x8_t vc255 asm ("d3") = vmov_n_u8(255);
+ #else
+ union { uint8x16x4_t v4; uint8x16x3_t v3; } vals0;
+@@ -1019,7 +1019,7 @@ void rgb2bgrx(const Size2D &size,
+ vals8.v4.val[3] = vmov_n_u8(255);
+ #endif
+
+-#if !defined(__GNUC__) || !defined(__arm__)
++#if !(!defined(__aarch64__) && defined(__GNUC__) && defined(__arm__))
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+ #endif
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+@@ -1030,7 +1030,7 @@ void rgb2bgrx(const Size2D &size,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u, j = 0u;
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ for (; j < roiw8; sj += 24, dj += 32, j += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -1409,7 +1409,7 @@ inline void convertToHSV(const s32 r, const s32 g, const s32 b,
+ "d24","d25","d26","d27","d28","d29","d30","d31" \
+ );
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+
+ #define YCRCB_CONSTS \
+ register int16x4_t vcYR asm ("d31") = vmov_n_s16(4899); \
+@@ -1555,7 +1555,7 @@ inline uint8x8x3_t convertToYCrCb( const int16x8_t& vR, const int16x8_t& vG, con
+ #define COEFF_G ( 8663)
+ #define COEFF_B (-17705)
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ #define YUV420ALPHA3_CONST
+ #define YUV420ALPHA4_CONST register uint8x16_t c255 asm ("q13") = vmovq_n_u8(255);
+ #define YUV420ALPHA3_CONVERT
+@@ -1852,7 +1852,7 @@ void rgb2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -1871,7 +1871,7 @@ void rgb2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERT_TO_HSV_ASM(vld3.8 {d0-d2}, d0, d2)
+ #else
+ uint8x8x3_t vRgb = vld3_u8(src + sj);
+@@ -1904,7 +1904,7 @@ void rgbx2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -1923,7 +1923,7 @@ void rgbx2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERT_TO_HSV_ASM(vld4.8 {d0-d3}, d0, d2)
+ #else
+ uint8x8x4_t vRgb = vld4_u8(src + sj);
+@@ -1956,7 +1956,7 @@ void bgr2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -1975,7 +1975,7 @@ void bgr2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERT_TO_HSV_ASM(vld3.8 {d0-d2}, d2, d0)
+ #else
+ uint8x8x3_t vRgb = vld3_u8(src + sj);
+@@ -2008,7 +2008,7 @@ void bgrx2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -2027,7 +2027,7 @@ void bgrx2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERT_TO_HSV_ASM(vld4.8 {d0-d3}, d2, d0)
+ #else
+ uint8x8x4_t vRgb = vld4_u8(src + sj);
+@@ -2068,7 +2068,7 @@ void rgbx2bgr565(const Size2D &size,
+ for (; j < roiw16; sj += 64, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld4.8 {d2, d4, d6, d8}, [%[in0]] @ q0 q1 q2 q3 q4 \n\t"
+ "vld4.8 {d3, d5, d7, d9}, [%[in1]] @ xxxxxxxx rrrrRRRR ggggGGGG bbbbBBBB xxxxxxxx \n\t"
+@@ -2122,7 +2122,7 @@ void rgb2bgr565(const Size2D &size,
+ for (; j < roiw16; sj += 48, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld3.8 {d2, d4, d6}, [%[in0]] @ q0 q1 q2 q3 q4 \n\t"
+ "vld3.8 {d3, d5, d7}, [%[in1]] @ xxxxxxxx rrrrRRRR ggggGGGG bbbbBBBB xxxxxxxx \n\t"
+@@ -2176,7 +2176,7 @@ void rgbx2rgb565(const Size2D &size,
+ for (; j < roiw16; sj += 64, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld4.8 {d0, d2, d4, d6}, [%[in0]] @ q0 q1 q2 q3 \n\t"
+ "vld4.8 {d1, d3, d5, d7}, [%[in1]] @ rrrrRRRR ggggGGGG bbbbBBBB aaaaAAAA \n\t"
+@@ -2230,7 +2230,7 @@ void rgb2rgb565(const Size2D &size,
+ for (; j < roiw16; sj += 48, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld3.8 {d0, d2, d4}, [%[in0]] @ q0 q1 q2 q3 \n\t"
+ "vld3.8 {d1, d3, d5}, [%[in1]] @ rrrrRRRR ggggGGGG bbbbBBBB xxxxxxxx \n\t"
+@@ -2285,7 +2285,7 @@ void rgb2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTTOYCRCB(vld3.8 {d0-d2}, d0, d1, d2)
+ #else
+ uint8x8x3_t vRgb = vld3_u8(src + sj);
+@@ -2329,7 +2329,7 @@ void rgbx2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTTOYCRCB(vld4.8 {d0-d3}, d0, d1, d2)
+ #else
+ uint8x8x4_t vRgba = vld4_u8(src + sj);
+@@ -2373,7 +2373,7 @@ void bgr2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTTOYCRCB(vld3.8 {d0-d2}, d2, d1, d0)
+ #else
+ uint8x8x3_t vBgr = vld3_u8(src + sj);
+@@ -2417,7 +2417,7 @@ void bgrx2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTTOYCRCB(vld4.8 {d0-d3}, d2, d1, d0)
+ #else
+ uint8x8x4_t vBgra = vld4_u8(src + sj);
+@@ -2499,7 +2499,7 @@ void yuv420sp2rgb(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(3, d1, d0, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2545,7 +2545,7 @@ void yuv420sp2rgbx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(4, d1, d0, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2591,7 +2591,7 @@ void yuv420i2rgb(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(3, d0, d1, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2637,7 +2637,7 @@ void yuv420i2rgbx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(4, d0, d1, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2683,7 +2683,7 @@ void yuv420sp2bgr(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(3, d1, d0, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2729,7 +2729,7 @@ void yuv420sp2bgrx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(4, d1, d0, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2775,7 +2775,7 @@ void yuv420i2bgr(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(3, d0, d1, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2821,7 +2821,7 @@ void yuv420i2bgrx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CONVERTYUV420TORGB(4, d0, d1, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+diff --git a/3rdparty/carotene/src/convert.cpp b/3rdparty/carotene/src/convert.cpp
+index 403f16d86a..64b6db78ab 100644
+--- a/3rdparty/carotene/src/convert.cpp
++++ b/3rdparty/carotene/src/convert.cpp
+@@ -101,7 +101,7 @@ CVT_FUNC(u8, s8, 16,
+ }
+ })
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVT_FUNC(u8, u16, 16,
+ register uint8x16_t zero0 asm ("q1") = vmovq_n_u8(0);,
+ {
+@@ -135,7 +135,7 @@ CVT_FUNC(u8, u16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVT_FUNC(u8, s32, 16,
+ register uint8x16_t zero0 asm ("q1") = vmovq_n_u8(0);
+ register uint8x16_t zero1 asm ("q2") = vmovq_n_u8(0);
+@@ -173,7 +173,7 @@ CVT_FUNC(u8, s32, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(u8, f32, 16,
+ ,
+ {
+@@ -248,7 +248,7 @@ CVT_FUNC(s8, u8, 16,
+ }
+ })
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVT_FUNC(s8, u16, 16,
+ register uint8x16_t zero0 asm ("q1") = vmovq_n_u8(0);,
+ {
+@@ -284,7 +284,7 @@ CVT_FUNC(s8, u16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s8, s16, 16,
+ ,
+ {
+@@ -323,7 +323,7 @@ CVT_FUNC(s8, s16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVT_FUNC(s8, s32, 16,
+ ,
+ {
+@@ -377,7 +377,7 @@ CVT_FUNC(s8, s32, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s8, f32, 16,
+ ,
+ {
+@@ -440,7 +440,7 @@ CVT_FUNC(s8, f32, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(u16, u8, 16,
+ ,
+ {
+@@ -479,7 +479,7 @@ CVT_FUNC(u16, u8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(u16, s8, 16,
+ register uint8x16_t v127 asm ("q4") = vmovq_n_u8(127);,
+ {
+@@ -522,7 +522,7 @@ CVT_FUNC(u16, s8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVT_FUNC(u16, s16, 8,
+ register uint16x8_t v32767 asm ("q4") = vmovq_n_u16(0x7FFF);,
+ {
+@@ -555,7 +555,7 @@ CVT_FUNC(u16, s16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVT_FUNC(u16, s32, 8,
+ register uint16x8_t zero0 asm ("q1") = vmovq_n_u16(0);,
+ {
+@@ -589,7 +589,7 @@ CVT_FUNC(u16, s32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(u16, f32, 8,
+ ,
+ {
+@@ -633,7 +633,7 @@ CVT_FUNC(u16, f32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s16, u8, 16,
+ ,
+ {
+@@ -672,7 +672,7 @@ CVT_FUNC(s16, u8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s16, s8, 16,
+ ,
+ {
+@@ -711,7 +711,7 @@ CVT_FUNC(s16, s8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVT_FUNC(s16, u16, 8,
+ register int16x8_t vZero asm ("q4") = vmovq_n_s16(0);,
+ {
+@@ -747,7 +747,7 @@ CVT_FUNC(s16, u16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s16, s32, 8,
+ ,
+ {
+@@ -786,7 +786,7 @@ CVT_FUNC(s16, s32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s16, f32, 8,
+ ,
+ {
+@@ -829,7 +829,7 @@ CVT_FUNC(s16, f32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s32, u8, 8,
+ ,
+ {
+@@ -870,7 +870,7 @@ CVT_FUNC(s32, u8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s32, s8, 8,
+ ,
+ {
+@@ -911,7 +911,7 @@ CVT_FUNC(s32, s8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s32, u16, 8,
+ ,
+ {
+@@ -950,7 +950,7 @@ CVT_FUNC(s32, u16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s32, s16, 8,
+ ,
+ {
+@@ -989,7 +989,7 @@ CVT_FUNC(s32, s16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(s32, f32, 8,
+ ,
+ {
+@@ -1034,7 +1034,7 @@ CVT_FUNC(s32, f32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(f32, u8, 8,
+ register float32x4_t vmult asm ("q0") = vdupq_n_f32((float)(1 << 16));
+ register uint32x4_t vmask asm ("q1") = vdupq_n_u32(1<<16);,
+@@ -1101,7 +1101,7 @@ CVT_FUNC(f32, u8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(f32, s8, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+@@ -1153,7 +1153,7 @@ CVT_FUNC(f32, s8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(f32, u16, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+@@ -1212,7 +1212,7 @@ CVT_FUNC(f32, u16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(f32, s16, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+@@ -1271,7 +1271,7 @@ CVT_FUNC(f32, s16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ CVT_FUNC(f32, s32, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+diff --git a/3rdparty/carotene/src/convert_scale.cpp b/3rdparty/carotene/src/convert_scale.cpp
+index 0a14a8035c..ae41a985c8 100644
+--- a/3rdparty/carotene/src/convert_scale.cpp
++++ b/3rdparty/carotene/src/convert_scale.cpp
+@@ -135,7 +135,7 @@ namespace CAROTENE_NS {
+
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC1(u8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -220,7 +220,7 @@ CVTS_FUNC1(u8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC(u8, s8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -305,7 +305,7 @@ CVTS_FUNC(u8, s8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC(u8, u16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -389,7 +389,7 @@ CVTS_FUNC(u8, u16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC(u8, s16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -473,7 +473,7 @@ CVTS_FUNC(u8, s16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(u8, s32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -562,7 +562,7 @@ CVTS_FUNC(u8, s32, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(u8, f32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -643,7 +643,7 @@ CVTS_FUNC(u8, f32, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC(s8, u8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -728,7 +728,7 @@ CVTS_FUNC(s8, u8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC1(s8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -813,7 +813,7 @@ CVTS_FUNC1(s8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC(s8, u16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -899,7 +899,7 @@ CVTS_FUNC(s8, u16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ CVTS_FUNC(s8, s16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -985,7 +985,7 @@ CVTS_FUNC(s8, s16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s8, s32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1074,7 +1074,7 @@ CVTS_FUNC(s8, s32, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s8, f32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -1155,7 +1155,7 @@ CVTS_FUNC(s8, f32, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(u16, u8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1214,7 +1214,7 @@ CVTS_FUNC(u16, u8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(u16, s8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1273,7 +1273,7 @@ CVTS_FUNC(u16, s8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC1(u16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1330,7 +1330,7 @@ CVTS_FUNC1(u16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(u16, s16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1387,7 +1387,7 @@ CVTS_FUNC(u16, s16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(u16, s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1443,7 +1443,7 @@ CVTS_FUNC(u16, s32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(u16, f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -1495,7 +1495,7 @@ CVTS_FUNC(u16, f32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s16, u8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1554,7 +1554,7 @@ CVTS_FUNC(s16, u8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s16, s8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1613,7 +1613,7 @@ CVTS_FUNC(s16, s8, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s16, u16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1670,7 +1670,7 @@ CVTS_FUNC(s16, u16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC1(s16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1727,7 +1727,7 @@ CVTS_FUNC1(s16, 16,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s16, s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1783,7 +1783,7 @@ CVTS_FUNC(s16, s32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s16, f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -1835,7 +1835,7 @@ CVTS_FUNC(s16, f32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s32, u8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1893,7 +1893,7 @@ CVTS_FUNC(s32, u8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s32, s8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1951,7 +1951,7 @@ CVTS_FUNC(s32, s8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s32, u16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2007,7 +2007,7 @@ CVTS_FUNC(s32, u16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s32, s16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2063,7 +2063,7 @@ CVTS_FUNC(s32, s16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC1(s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2118,7 +2118,7 @@ CVTS_FUNC1(s32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(s32, f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -2169,7 +2169,7 @@ CVTS_FUNC(s32, f32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(f32, u8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)((1 << 16)*alpha));
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)((1 << 16)*beta));
+@@ -2239,7 +2239,7 @@ CVTS_FUNC(f32, u8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(f32, s8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2293,7 +2293,7 @@ CVTS_FUNC(f32, s8, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(f32, u16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2345,7 +2345,7 @@ CVTS_FUNC(f32, u16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(f32, s16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2397,7 +2397,7 @@ CVTS_FUNC(f32, s16, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC(f32, s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2448,7 +2448,7 @@ CVTS_FUNC(f32, s32, 8,
+ })
+ #endif
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ CVTS_FUNC1(f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+diff --git a/3rdparty/carotene/src/gaussian_blur.cpp b/3rdparty/carotene/src/gaussian_blur.cpp
+index 1b5399436f..f7b5f18d79 100644
+--- a/3rdparty/carotene/src/gaussian_blur.cpp
++++ b/3rdparty/carotene/src/gaussian_blur.cpp
+@@ -327,7 +327,7 @@ void gaussianBlur5x5(const Size2D &size, s32 cn,
+ u16* lidx1 = lane + x - 1*2;
+ u16* lidx3 = lane + x + 1*2;
+ u16* lidx4 = lane + x + 2*2;
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ __volatile__ (
+ "vld2.16 {d0, d2}, [%[in0]]! \n\t"
+ "vld2.16 {d1, d3}, [%[in0]] \n\t"
+@@ -398,7 +398,7 @@ void gaussianBlur5x5(const Size2D &size, s32 cn,
+ u16* lidx1 = lane + x - 1*3;
+ u16* lidx3 = lane + x + 1*3;
+ u16* lidx4 = lane + x + 2*3;
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ __volatile__ (
+ "vld3.16 {d0, d2, d4}, [%[in0]]! \n\t"
+ "vld3.16 {d1, d3, d5}, [%[in0]] \n\t"
+@@ -482,7 +482,7 @@ void gaussianBlur5x5(const Size2D &size, s32 cn,
+ u16* lidx1 = lane + x - 1*4;
+ u16* lidx3 = lane + x + 1*4;
+ u16* lidx4 = lane + x + 2*4;
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ __volatile__ (
+ "vld4.16 {d0, d2, d4, d6}, [%[in0]]! \n\t"
+ "vld4.16 {d1, d3, d5, d7}, [%[in0]] \n\t"
+diff --git a/3rdparty/carotene/src/pyramid.cpp b/3rdparty/carotene/src/pyramid.cpp
+index 8ef1268933..232ccf3efd 100644
+--- a/3rdparty/carotene/src/pyramid.cpp
++++ b/3rdparty/carotene/src/pyramid.cpp
+@@ -331,7 +331,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ for (; x < roiw8; x += 8)
+ {
+ internal::prefetch(lane + 2 * x);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld2.16 {d0-d3}, [%[in0]] \n\t"
+ "vld2.16 {d4-d7}, [%[in4]] \n\t"
+@@ -538,7 +538,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ for (; x < roiw4; x += 4)
+ {
+ internal::prefetch(lane + 2 * x);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld2.32 {d0-d3}, [%[in0]] \n\t"
+ "vld2.32 {d4-d7}, [%[in4]] \n\t"
+@@ -672,7 +672,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ std::vector<f32> _buf(cn*(srcSize.width + 4) + 32/sizeof(f32));
+ f32* lane = internal::alignPtr(&_buf[2*cn], 32);
+
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ register float32x4_t vc6d4f32 asm ("q11") = vmovq_n_f32(1.5f); // 6/4
+ register float32x4_t vc1d4f32 asm ("q12") = vmovq_n_f32(0.25f); // 1/4
+
+@@ -739,7 +739,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ for (; x < roiw4; x += 4)
+ {
+ internal::prefetch(lane + 2 * x);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ __volatile__ (
+ "vld2.32 {d0-d3}, [%[in0]] \n\t"
+ "vld2.32 {d8-d11}, [%[in4]] \n\t"
+@@ -932,7 +932,7 @@ pyrUp8uHorizontalConvolution:
+ for (; x < lim; x += 8)
+ {
+ internal::prefetch(lane + x);
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ (
+ "vld1.16 {d0-d1}, [%[in0]] /*q0 = v0*/ \n\t"
+ "vld1.16 {d2-d3}, [%[in2]] /*q1 = v2*/ \n\t"
+@@ -973,7 +973,7 @@ pyrUp8uHorizontalConvolution:
+ for (; x < lim; x += 24)
+ {
+ internal::prefetch(lane + x);
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ (
+ "vmov.u16 q9, #6 \n\t"
+ "vld3.16 {d0, d2, d4}, [%[in0]] /*v0*/ \n\t"
+@@ -1064,7 +1064,7 @@ pyrUp8uHorizontalConvolution:
+ for (; x < lim; x += 8)
+ {
+ internal::prefetch(lane + x);
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ (
+ "vld1.16 {d0-d1}, [%[in0]] /*q0 = v0*/ \n\t"
+ "vld1.16 {d2-d3}, [%[in2]] /*q1 = v2*/ \n\t"
+@@ -1210,7 +1210,7 @@ pyrUp16sHorizontalConvolution:
+ for (; x < lim; x += 4)
+ {
+ internal::prefetch(lane + x);
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ (
+ "vld1.32 {d0-d1}, [%[in0]] /*q0 = v0*/ \n\t"
+ "vld1.32 {d2-d3}, [%[in2]] /*q1 = v2*/ \n\t"
+@@ -1251,7 +1251,7 @@ pyrUp16sHorizontalConvolution:
+ for (; x < lim; x += 12)
+ {
+ internal::prefetch(lane + x + 3);
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ (
+ "vmov.s32 q9, #6 \n\t"
+ "vld3.32 {d0, d2, d4}, [%[in0]] /*v0*/ \n\t"
+@@ -1343,7 +1343,7 @@ pyrUp16sHorizontalConvolution:
+ for (; x < lim; x += 4)
+ {
+ internal::prefetch(lane + x);
+-#if defined(__GNUC__) && defined(__arm__)
++#if !defined(__aarch64__) && defined(__GNUC__) && defined(__arm__)
+ __asm__ (
+ "vld1.32 {d0-d1}, [%[in0]] /*q0 = v0*/ \n\t"
+ "vld1.32 {d2-d3}, [%[in2]] /*q1 = v2*/ \n\t"
+diff --git a/3rdparty/carotene/src/scharr.cpp b/3rdparty/carotene/src/scharr.cpp
+index 5695804fe4..8d3b6328b1 100644
+--- a/3rdparty/carotene/src/scharr.cpp
++++ b/3rdparty/carotene/src/scharr.cpp
+@@ -109,7 +109,7 @@ void ScharrDeriv(const Size2D &size, s32 cn,
+ internal::prefetch(srow0 + x);
+ internal::prefetch(srow1 + x);
+ internal::prefetch(srow2 + x);
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
+ __asm__ (
+ "vld1.8 {d0}, [%[src0]] \n\t"
+ "vld1.8 {d2}, [%[src2]] \n\t"
+@@ -161,7 +161,7 @@ void ScharrDeriv(const Size2D &size, s32 cn,
+ x = 0;
+ for( ; x < roiw8; x += 8 )
+ {
+-#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
+ __asm__ (
+ "vld1.16 {d4-d5}, [%[s2ptr]] \n\t"
+ "vld1.16 {d8-d9}, [%[s4ptr]] \n\t"
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Do-not-enable-asm-with-clang.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Do-not-enable-asm-with-clang.patch
new file mode 100644
index 000000000..22e868a03
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Do-not-enable-asm-with-clang.patch
@@ -0,0 +1,993 @@
+From 333f60165b6737588eb975a5e4393d847011a1cd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 19 Sep 2017 18:07:35 -0700
+Subject: [PATCH 2/2] Do not enable asm with clang
+
+clang pretends to be gcc 4.2.0 which means we will
+use inline asm for no reason, instead of builtins
+on clang when possible.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+ 3rdparty/carotene/src/channel_extract.cpp | 4 +-
+ 3rdparty/carotene/src/channels_combine.cpp | 2 +-
+ 3rdparty/carotene/src/colorconvert.cpp | 78 +++++++++++++++---------------
+ 3rdparty/carotene/src/convert.cpp | 54 ++++++++++-----------
+ 3rdparty/carotene/src/convert_scale.cpp | 56 ++++++++++-----------
+ 3rdparty/carotene/src/gaussian_blur.cpp | 2 +-
+ 3rdparty/carotene/src/pyramid.cpp | 8 +--
+ 3rdparty/carotene/src/scharr.cpp | 4 +-
+ 8 files changed, 104 insertions(+), 104 deletions(-)
+
+diff --git a/3rdparty/carotene/src/channel_extract.cpp b/3rdparty/carotene/src/channel_extract.cpp
+index 8238a3ece8..ff4fb3770c 100644
+--- a/3rdparty/carotene/src/channel_extract.cpp
++++ b/3rdparty/carotene/src/channel_extract.cpp
+@@ -231,7 +231,7 @@ void extract4(const Size2D &size,
+ srcStride == dst2Stride && \
+ srcStride == dst3Stride &&
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+
+ #define SPLIT_ASM2(sgn, bits) __asm__ ( \
+ "vld2." #bits " {d0, d2}, [%[in0]] \n\t" \
+@@ -351,7 +351,7 @@ void extract4(const Size2D &size,
+ } \
+ }
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+
+ #define ALPHA_QUAD(sgn, bits) { \
+ internal::prefetch(src + sj); \
+diff --git a/3rdparty/carotene/src/channels_combine.cpp b/3rdparty/carotene/src/channels_combine.cpp
+index fc98fb9181..5d9251d51c 100644
+--- a/3rdparty/carotene/src/channels_combine.cpp
++++ b/3rdparty/carotene/src/channels_combine.cpp
+@@ -77,7 +77,7 @@ namespace CAROTENE_NS {
+ dstStride == src2Stride && \
+ dstStride == src3Stride &&
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+
+ #define MERGE_ASM2(sgn, bits) __asm__ ( \
+ "vld1." #bits " {d0-d1}, [%[in0]] \n\t" \
+diff --git a/3rdparty/carotene/src/colorconvert.cpp b/3rdparty/carotene/src/colorconvert.cpp
+index 26ae54b15c..d3a40fe64e 100644
+--- a/3rdparty/carotene/src/colorconvert.cpp
++++ b/3rdparty/carotene/src/colorconvert.cpp
+@@ -97,7 +97,7 @@ void rgb2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -116,7 +116,7 @@ void rgb2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ for (; dj < roiw8; sj += 24, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -198,7 +198,7 @@ void rgbx2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -217,7 +217,7 @@ void rgbx2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ for (; dj < roiw8; sj += 32, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -300,7 +300,7 @@ void bgr2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -319,7 +319,7 @@ void bgr2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ for (; dj < roiw8; sj += 24, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -402,7 +402,7 @@ void bgrx2gray(const Size2D &size, COLOR_SPACE color_space,
+ const u32 G2Y = color_space == COLOR_SPACE_BT601 ? G2Y_BT601 : G2Y_BT709;
+ const u32 B2Y = color_space == COLOR_SPACE_BT601 ? B2Y_BT601 : B2Y_BT709;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register int16x4_t v_r2y asm ("d31") = vmov_n_s16(R2Y);
+ register int16x4_t v_g2y asm ("d30") = vmov_n_s16(G2Y);
+ register int16x4_t v_b2y asm ("d29") = vmov_n_s16(B2Y);
+@@ -421,7 +421,7 @@ void bgrx2gray(const Size2D &size, COLOR_SPACE color_space,
+ u8 * dst = internal::getRowPtr(dstBase, dstStride, i);
+ size_t sj = 0u, dj = 0u;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ for (; dj < roiw8; sj += 32, dj += 8)
+ {
+ internal::prefetch(src + sj);
+@@ -512,7 +512,7 @@ void gray2rgb(const Size2D &size,
+ for (; sj < roiw16; sj += 16, dj += 48)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld1.8 {d0-d1}, [%[in0]] \n\t"
+ "vmov.8 q1, q0 \n\t"
+@@ -538,7 +538,7 @@ void gray2rgb(const Size2D &size,
+
+ if (sj < roiw8)
+ {
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld1.8 {d0}, [%[in]] \n\t"
+ "vmov.8 d1, d0 \n\t"
+@@ -584,7 +584,7 @@ void gray2rgbx(const Size2D &size,
+ size_t roiw16 = size.width >= 15 ? size.width - 15 : 0;
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register uint8x16_t vc255 asm ("q4") = vmovq_n_u8(255);
+ #else
+ uint8x16x4_t vRgba;
+@@ -602,7 +602,7 @@ void gray2rgbx(const Size2D &size,
+ for (; sj < roiw16; sj += 16, dj += 64)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld1.8 {d0-d1}, [%[in0]] \n\t"
+ "vmov.8 q1, q0 \n\t"
+@@ -628,7 +628,7 @@ void gray2rgbx(const Size2D &size,
+
+ if (sj < roiw8)
+ {
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld1.8 {d5}, [%[in]] \n\t"
+ "vmov.8 d6, d5 \n\t"
+@@ -1409,7 +1409,7 @@ inline void convertToHSV(const s32 r, const s32 g, const s32 b,
+ "d24","d25","d26","d27","d28","d29","d30","d31" \
+ );
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+
+ #define YCRCB_CONSTS \
+ register int16x4_t vcYR asm ("d31") = vmov_n_s16(4899); \
+@@ -1555,7 +1555,7 @@ inline uint8x8x3_t convertToYCrCb( const int16x8_t& vR, const int16x8_t& vG, con
+ #define COEFF_G ( 8663)
+ #define COEFF_B (-17705)
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ #define YUV420ALPHA3_CONST
+ #define YUV420ALPHA4_CONST register uint8x16_t c255 asm ("q13") = vmovq_n_u8(255);
+ #define YUV420ALPHA3_CONVERT
+@@ -1852,7 +1852,7 @@ void rgb2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -1871,7 +1871,7 @@ void rgb2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERT_TO_HSV_ASM(vld3.8 {d0-d2}, d0, d2)
+ #else
+ uint8x8x3_t vRgb = vld3_u8(src + sj);
+@@ -1904,7 +1904,7 @@ void rgbx2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -1923,7 +1923,7 @@ void rgbx2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERT_TO_HSV_ASM(vld4.8 {d0-d3}, d0, d2)
+ #else
+ uint8x8x4_t vRgb = vld4_u8(src + sj);
+@@ -1956,7 +1956,7 @@ void bgr2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -1975,7 +1975,7 @@ void bgr2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERT_TO_HSV_ASM(vld3.8 {d0-d2}, d2, d0)
+ #else
+ uint8x8x3_t vRgb = vld3_u8(src + sj);
+@@ -2008,7 +2008,7 @@ void bgrx2hsv(const Size2D &size,
+ #ifdef CAROTENE_NEON
+ size_t roiw8 = size.width >= 7 ? size.width - 7 : 0;
+ const s32 hsv_shift = 12;
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register const f32 vsdiv_table = f32(255 << hsv_shift);
+ register f32 vhdiv_table = f32(hrange << hsv_shift);
+ register const s32 vhrange = hrange;
+@@ -2027,7 +2027,7 @@ void bgrx2hsv(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERT_TO_HSV_ASM(vld4.8 {d0-d3}, d2, d0)
+ #else
+ uint8x8x4_t vRgb = vld4_u8(src + sj);
+@@ -2068,7 +2068,7 @@ void rgbx2bgr565(const Size2D &size,
+ for (; j < roiw16; sj += 64, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld4.8 {d2, d4, d6, d8}, [%[in0]] @ q0 q1 q2 q3 q4 \n\t"
+ "vld4.8 {d3, d5, d7, d9}, [%[in1]] @ xxxxxxxx rrrrRRRR ggggGGGG bbbbBBBB xxxxxxxx \n\t"
+@@ -2122,7 +2122,7 @@ void rgb2bgr565(const Size2D &size,
+ for (; j < roiw16; sj += 48, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld3.8 {d2, d4, d6}, [%[in0]] @ q0 q1 q2 q3 q4 \n\t"
+ "vld3.8 {d3, d5, d7}, [%[in1]] @ xxxxxxxx rrrrRRRR ggggGGGG bbbbBBBB xxxxxxxx \n\t"
+@@ -2176,7 +2176,7 @@ void rgbx2rgb565(const Size2D &size,
+ for (; j < roiw16; sj += 64, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld4.8 {d0, d2, d4, d6}, [%[in0]] @ q0 q1 q2 q3 \n\t"
+ "vld4.8 {d1, d3, d5, d7}, [%[in1]] @ rrrrRRRR ggggGGGG bbbbBBBB aaaaAAAA \n\t"
+@@ -2230,7 +2230,7 @@ void rgb2rgb565(const Size2D &size,
+ for (; j < roiw16; sj += 48, dj += 32, j += 16)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld3.8 {d0, d2, d4}, [%[in0]] @ q0 q1 q2 q3 \n\t"
+ "vld3.8 {d1, d3, d5}, [%[in1]] @ rrrrRRRR ggggGGGG bbbbBBBB xxxxxxxx \n\t"
+@@ -2285,7 +2285,7 @@ void rgb2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTTOYCRCB(vld3.8 {d0-d2}, d0, d1, d2)
+ #else
+ uint8x8x3_t vRgb = vld3_u8(src + sj);
+@@ -2329,7 +2329,7 @@ void rgbx2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTTOYCRCB(vld4.8 {d0-d3}, d0, d1, d2)
+ #else
+ uint8x8x4_t vRgba = vld4_u8(src + sj);
+@@ -2373,7 +2373,7 @@ void bgr2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 24, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTTOYCRCB(vld3.8 {d0-d2}, d2, d1, d0)
+ #else
+ uint8x8x3_t vBgr = vld3_u8(src + sj);
+@@ -2417,7 +2417,7 @@ void bgrx2ycrcb(const Size2D &size,
+ for (; j < roiw8; sj += 32, dj += 24, j += 8)
+ {
+ internal::prefetch(src + sj);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTTOYCRCB(vld4.8 {d0-d3}, d2, d1, d0)
+ #else
+ uint8x8x4_t vBgra = vld4_u8(src + sj);
+@@ -2499,7 +2499,7 @@ void yuv420sp2rgb(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(3, d1, d0, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2545,7 +2545,7 @@ void yuv420sp2rgbx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(4, d1, d0, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2591,7 +2591,7 @@ void yuv420i2rgb(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(3, d0, d1, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2637,7 +2637,7 @@ void yuv420i2rgbx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(4, d0, d1, q5, q6)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2683,7 +2683,7 @@ void yuv420sp2bgr(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(3, d1, d0, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2729,7 +2729,7 @@ void yuv420sp2bgrx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(4, d1, d0, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2775,7 +2775,7 @@ void yuv420i2bgr(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(3, d0, d1, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+@@ -2821,7 +2821,7 @@ void yuv420i2bgrx(const Size2D &size,
+ internal::prefetch(uv + j);
+ internal::prefetch(y1 + j);
+ internal::prefetch(y2 + j);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CONVERTYUV420TORGB(4, d0, d1, q6, q5)
+ #else
+ convertYUV420.ToRGB(y1 + j, y2 + j, uv + j, dst1 + dj, dst2 + dj);
+diff --git a/3rdparty/carotene/src/convert.cpp b/3rdparty/carotene/src/convert.cpp
+index 64b6db78ab..f0c2d153f2 100644
+--- a/3rdparty/carotene/src/convert.cpp
++++ b/3rdparty/carotene/src/convert.cpp
+@@ -101,7 +101,7 @@ CVT_FUNC(u8, s8, 16,
+ }
+ })
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVT_FUNC(u8, u16, 16,
+ register uint8x16_t zero0 asm ("q1") = vmovq_n_u8(0);,
+ {
+@@ -135,7 +135,7 @@ CVT_FUNC(u8, u16, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVT_FUNC(u8, s32, 16,
+ register uint8x16_t zero0 asm ("q1") = vmovq_n_u8(0);
+ register uint8x16_t zero1 asm ("q2") = vmovq_n_u8(0);
+@@ -173,7 +173,7 @@ CVT_FUNC(u8, s32, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(u8, f32, 16,
+ ,
+ {
+@@ -248,7 +248,7 @@ CVT_FUNC(s8, u8, 16,
+ }
+ })
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVT_FUNC(s8, u16, 16,
+ register uint8x16_t zero0 asm ("q1") = vmovq_n_u8(0);,
+ {
+@@ -284,7 +284,7 @@ CVT_FUNC(s8, u16, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s8, s16, 16,
+ ,
+ {
+@@ -323,7 +323,7 @@ CVT_FUNC(s8, s16, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVT_FUNC(s8, s32, 16,
+ ,
+ {
+@@ -377,7 +377,7 @@ CVT_FUNC(s8, s32, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s8, f32, 16,
+ ,
+ {
+@@ -440,7 +440,7 @@ CVT_FUNC(s8, f32, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(u16, u8, 16,
+ ,
+ {
+@@ -479,7 +479,7 @@ CVT_FUNC(u16, u8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(u16, s8, 16,
+ register uint8x16_t v127 asm ("q4") = vmovq_n_u8(127);,
+ {
+@@ -522,7 +522,7 @@ CVT_FUNC(u16, s8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVT_FUNC(u16, s16, 8,
+ register uint16x8_t v32767 asm ("q4") = vmovq_n_u16(0x7FFF);,
+ {
+@@ -555,7 +555,7 @@ CVT_FUNC(u16, s16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVT_FUNC(u16, s32, 8,
+ register uint16x8_t zero0 asm ("q1") = vmovq_n_u16(0);,
+ {
+@@ -589,7 +589,7 @@ CVT_FUNC(u16, s32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(u16, f32, 8,
+ ,
+ {
+@@ -633,7 +633,7 @@ CVT_FUNC(u16, f32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s16, u8, 16,
+ ,
+ {
+@@ -672,7 +672,7 @@ CVT_FUNC(s16, u8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s16, s8, 16,
+ ,
+ {
+@@ -711,7 +711,7 @@ CVT_FUNC(s16, s8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVT_FUNC(s16, u16, 8,
+ register int16x8_t vZero asm ("q4") = vmovq_n_s16(0);,
+ {
+@@ -747,7 +747,7 @@ CVT_FUNC(s16, u16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s16, s32, 8,
+ ,
+ {
+@@ -786,7 +786,7 @@ CVT_FUNC(s16, s32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s16, f32, 8,
+ ,
+ {
+@@ -829,7 +829,7 @@ CVT_FUNC(s16, f32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s32, u8, 8,
+ ,
+ {
+@@ -870,7 +870,7 @@ CVT_FUNC(s32, u8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s32, s8, 8,
+ ,
+ {
+@@ -911,7 +911,7 @@ CVT_FUNC(s32, s8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s32, u16, 8,
+ ,
+ {
+@@ -950,7 +950,7 @@ CVT_FUNC(s32, u16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s32, s16, 8,
+ ,
+ {
+@@ -989,7 +989,7 @@ CVT_FUNC(s32, s16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(s32, f32, 8,
+ ,
+ {
+@@ -1034,7 +1034,7 @@ CVT_FUNC(s32, f32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(f32, u8, 8,
+ register float32x4_t vmult asm ("q0") = vdupq_n_f32((float)(1 << 16));
+ register uint32x4_t vmask asm ("q1") = vdupq_n_u32(1<<16);,
+@@ -1101,7 +1101,7 @@ CVT_FUNC(f32, u8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(f32, s8, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+@@ -1153,7 +1153,7 @@ CVT_FUNC(f32, s8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(f32, u16, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+@@ -1212,7 +1212,7 @@ CVT_FUNC(f32, u16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(f32, s16, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+@@ -1271,7 +1271,7 @@ CVT_FUNC(f32, s16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ CVT_FUNC(f32, s32, 8,
+ register float32x4_t vhalf asm ("q0") = vdupq_n_f32(0.5f);,
+ {
+diff --git a/3rdparty/carotene/src/convert_scale.cpp b/3rdparty/carotene/src/convert_scale.cpp
+index ae41a985c8..d599d24c1e 100644
+--- a/3rdparty/carotene/src/convert_scale.cpp
++++ b/3rdparty/carotene/src/convert_scale.cpp
+@@ -473,7 +473,7 @@ CVTS_FUNC(u8, s16, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(u8, s32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -562,7 +562,7 @@ CVTS_FUNC(u8, s32, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(u8, f32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -985,7 +985,7 @@ CVTS_FUNC(s8, s16, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s8, s32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1074,7 +1074,7 @@ CVTS_FUNC(s8, s32, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s8, f32, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -1155,7 +1155,7 @@ CVTS_FUNC(s8, f32, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(u16, u8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1214,7 +1214,7 @@ CVTS_FUNC(u16, u8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(u16, s8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1273,7 +1273,7 @@ CVTS_FUNC(u16, s8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC1(u16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1330,7 +1330,7 @@ CVTS_FUNC1(u16, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(u16, s16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1387,7 +1387,7 @@ CVTS_FUNC(u16, s16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(u16, s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1443,7 +1443,7 @@ CVTS_FUNC(u16, s32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(u16, f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -1495,7 +1495,7 @@ CVTS_FUNC(u16, f32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s16, u8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1554,7 +1554,7 @@ CVTS_FUNC(s16, u8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s16, s8, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1613,7 +1613,7 @@ CVTS_FUNC(s16, s8, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s16, u16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1670,7 +1670,7 @@ CVTS_FUNC(s16, u16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC1(s16, 16,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1727,7 +1727,7 @@ CVTS_FUNC1(s16, 16,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s16, s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1783,7 +1783,7 @@ CVTS_FUNC(s16, s32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s16, f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -1835,7 +1835,7 @@ CVTS_FUNC(s16, f32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s32, u8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1893,7 +1893,7 @@ CVTS_FUNC(s32, u8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s32, s8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -1951,7 +1951,7 @@ CVTS_FUNC(s32, s8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s32, u16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2007,7 +2007,7 @@ CVTS_FUNC(s32, u16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s32, s16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2063,7 +2063,7 @@ CVTS_FUNC(s32, s16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC1(s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2118,7 +2118,7 @@ CVTS_FUNC1(s32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(s32, f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+@@ -2169,7 +2169,7 @@ CVTS_FUNC(s32, f32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(f32, u8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)((1 << 16)*alpha));
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)((1 << 16)*beta));
+@@ -2239,7 +2239,7 @@ CVTS_FUNC(f32, u8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(f32, s8, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2293,7 +2293,7 @@ CVTS_FUNC(f32, s8, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(f32, u16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2345,7 +2345,7 @@ CVTS_FUNC(f32, u16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(f32, s16, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2397,7 +2397,7 @@ CVTS_FUNC(f32, s16, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC(f32, s32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta + 0.5f);,
+@@ -2448,7 +2448,7 @@ CVTS_FUNC(f32, s32, 8,
+ })
+ #endif
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ CVTS_FUNC1(f32, 8,
+ register float32x4_t vscale asm ("q0") = vdupq_n_f32((f32)alpha);
+ register float32x4_t vshift asm ("q1") = vdupq_n_f32((f32)beta);,
+diff --git a/3rdparty/carotene/src/gaussian_blur.cpp b/3rdparty/carotene/src/gaussian_blur.cpp
+index f7b5f18d79..e5aa8fc75b 100644
+--- a/3rdparty/carotene/src/gaussian_blur.cpp
++++ b/3rdparty/carotene/src/gaussian_blur.cpp
+@@ -327,7 +327,7 @@ void gaussianBlur5x5(const Size2D &size, s32 cn,
+ u16* lidx1 = lane + x - 1*2;
+ u16* lidx3 = lane + x + 1*2;
+ u16* lidx4 = lane + x + 2*2;
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ __volatile__ (
+ "vld2.16 {d0, d2}, [%[in0]]! \n\t"
+ "vld2.16 {d1, d3}, [%[in0]] \n\t"
+diff --git a/3rdparty/carotene/src/pyramid.cpp b/3rdparty/carotene/src/pyramid.cpp
+index 232ccf3efd..d4e32ea50f 100644
+--- a/3rdparty/carotene/src/pyramid.cpp
++++ b/3rdparty/carotene/src/pyramid.cpp
+@@ -331,7 +331,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ for (; x < roiw8; x += 8)
+ {
+ internal::prefetch(lane + 2 * x);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld2.16 {d0-d3}, [%[in0]] \n\t"
+ "vld2.16 {d4-d7}, [%[in4]] \n\t"
+@@ -538,7 +538,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ for (; x < roiw4; x += 4)
+ {
+ internal::prefetch(lane + 2 * x);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld2.32 {d0-d3}, [%[in0]] \n\t"
+ "vld2.32 {d4-d7}, [%[in4]] \n\t"
+@@ -672,7 +672,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ std::vector<f32> _buf(cn*(srcSize.width + 4) + 32/sizeof(f32));
+ f32* lane = internal::alignPtr(&_buf[2*cn], 32);
+
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ register float32x4_t vc6d4f32 asm ("q11") = vmovq_n_f32(1.5f); // 6/4
+ register float32x4_t vc1d4f32 asm ("q12") = vmovq_n_f32(0.25f); // 1/4
+
+@@ -739,7 +739,7 @@ void gaussianPyramidDown(const Size2D &srcSize,
+ for (; x < roiw4; x += 4)
+ {
+ internal::prefetch(lane + 2 * x);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ __volatile__ (
+ "vld2.32 {d0-d3}, [%[in0]] \n\t"
+ "vld2.32 {d8-d11}, [%[in4]] \n\t"
+diff --git a/3rdparty/carotene/src/scharr.cpp b/3rdparty/carotene/src/scharr.cpp
+index 8d3b6328b1..36f6b2276e 100644
+--- a/3rdparty/carotene/src/scharr.cpp
++++ b/3rdparty/carotene/src/scharr.cpp
+@@ -109,7 +109,7 @@ void ScharrDeriv(const Size2D &size, s32 cn,
+ internal::prefetch(srow0 + x);
+ internal::prefetch(srow1 + x);
+ internal::prefetch(srow2 + x);
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7 && !defined(__clang__)
+ __asm__ (
+ "vld1.8 {d0}, [%[src0]] \n\t"
+ "vld1.8 {d2}, [%[src2]] \n\t"
+@@ -161,7 +161,7 @@ void ScharrDeriv(const Size2D &size, s32 cn,
+ x = 0;
+ for( ; x < roiw8; x += 8 )
+ {
+-#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6
++#if !defined(__aarch64__) && defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6 && !defined(__clang__)
+ __asm__ (
+ "vld1.16 {d4-d5}, [%[s2ptr]] \n\t"
+ "vld1.16 {d8-d9}, [%[s4ptr]] \n\t"
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Make-opencv-ts-create-share-library-intead-of-static.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Make-opencv-ts-create-share-library-intead-of-static.patch
new file mode 100644
index 000000000..a845505a8
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-Make-opencv-ts-create-share-library-intead-of-static.patch
@@ -0,0 +1,26 @@
+From 350525293aef65490e80104ddd99e1b21c5d54b0 Mon Sep 17 00:00:00 2001
+From: Bian Naimeng <biannm@cn.fujitsu.com>
+Date: Wed, 19 Apr 2017 03:11:37 +0900
+Subject: [PATCH 2/3] Make opencv-ts create share library intead of static.
+
+Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
+---
+ modules/ts/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt
+index f95bed079..ee67858df 100644
+--- a/modules/ts/CMakeLists.txt
++++ b/modules/ts/CMakeLists.txt
+@@ -4,7 +4,7 @@ if(NOT BUILD_opencv_ts AND NOT BUILD_TESTS AND NOT BUILD_PERF_TESTS)
+ ocv_module_disable(ts)
+ endif()
+
+-set(OPENCV_MODULE_TYPE STATIC)
++#set(OPENCV_MODULE_TYPE STATIC)
+ set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
+
+ if(WINRT)
+--
+2.13.4
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-imgcodecs-refactoring-improve-code-quality.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-imgcodecs-refactoring-improve-code-quality.patch
new file mode 100644
index 000000000..39f33af9d
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0002-imgcodecs-refactoring-improve-code-quality.patch
@@ -0,0 +1,656 @@
+Upstream-Status: Backport [https://github.com/opencv/opencv/pull/9376/commits/999f41fb4f4aa94a0cb47256919ae8b5c29ca5f3]
+
+Fix CVEs for opencv 3.3:
+
+* CVE-2017-12597
+* CVE-2017-12598
+* CVE-2017-12599
+* CVE-2017-12600
+* CVE-2017-12601
+* CVE-2017-12602
+* CVE-2017-12603
+* CVE-2017-12604
+* CVE-2017-12605
+* CVE-2017-12606
+* CVE-2017-12862
+* CVE-2017-12863
+* CVE-2017-12864
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+From 999f41fb4f4aa94a0cb47256919ae8b5c29ca5f3 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
+Date: Tue, 15 Aug 2017 22:04:55 +0000
+Subject: [PATCH 2/3] imgcodecs: refactoring, improve code quality
+
+---
+ modules/imgcodecs/src/bitstrm.cpp | 2 +
+ modules/imgcodecs/src/bitstrm.hpp | 19 +++--
+ modules/imgcodecs/src/grfmt_bmp.cpp | 13 ++-
+ modules/imgcodecs/src/grfmt_pxm.cpp | 122 ++++++++++++++++-----------
+ modules/imgcodecs/src/loadsave.cpp | 164 +++++++++++++++++++++++++++++-------
+ 5 files changed, 231 insertions(+), 89 deletions(-)
+
+diff --git a/modules/imgcodecs/src/bitstrm.cpp b/modules/imgcodecs/src/bitstrm.cpp
+index a7e187fa0..0a8941aec 100644
+--- a/modules/imgcodecs/src/bitstrm.cpp
++++ b/modules/imgcodecs/src/bitstrm.cpp
+@@ -209,6 +209,8 @@ int RLByteStream::getByte()
+ current = m_current;
+ }
+
++ CV_Assert(current < m_end);
++
+ val = *((uchar*)current);
+ m_current = current + 1;
+ return val;
+diff --git a/modules/imgcodecs/src/bitstrm.hpp b/modules/imgcodecs/src/bitstrm.hpp
+index 465c0a847..26947971f 100644
+--- a/modules/imgcodecs/src/bitstrm.hpp
++++ b/modules/imgcodecs/src/bitstrm.hpp
+@@ -48,13 +48,20 @@
+ namespace cv
+ {
+
+-enum
+-{
+- RBS_THROW_EOS=-123, // <end of stream> exception code
+- RBS_THROW_FORB=-124, // <forrbidden huffman code> exception code
+- RBS_HUFF_FORB=2047, // forrbidden huffman code "value"
+- RBS_BAD_HEADER=-125 // invalid header
++#define DECLARE_RBS_EXCEPTION(name) \
++class RBS_ ## name ## _Exception : public cv::Exception \
++{ \
++public: \
++ RBS_ ## name ## _Exception(int code_, const String& err_, const String& func_, const String& file_, int line_) : \
++ cv::Exception(code_, err_, func_, file_, line_) \
++ {} \
+ };
++DECLARE_RBS_EXCEPTION(THROW_EOS)
++#define RBS_THROW_EOS RBS_THROW_EOS_Exception(cv::Error::StsError, "Unexpected end of input stream", CV_Func, __FILE__, __LINE__)
++DECLARE_RBS_EXCEPTION(THROW_FORB)
++#define RBS_THROW_FORB RBS_THROW_FORB_Exception(cv::Error::StsError, "Forrbidden huffman code", CV_Func, __FILE__, __LINE__)
++DECLARE_RBS_EXCEPTION(BAD_HEADER)
++#define RBS_BAD_HEADER RBS_BAD_HEADER_Exception(cv::Error::StsError, "Invalid header", CV_Func, __FILE__, __LINE__)
+
+ typedef unsigned long ulong;
+
+diff --git a/modules/imgcodecs/src/grfmt_bmp.cpp b/modules/imgcodecs/src/grfmt_bmp.cpp
+index 86cacd316..257f97c2d 100644
+--- a/modules/imgcodecs/src/grfmt_bmp.cpp
++++ b/modules/imgcodecs/src/grfmt_bmp.cpp
+@@ -118,8 +118,9 @@ bool BmpDecoder::readHeader()
+
+ if( m_bpp <= 8 )
+ {
+- memset( m_palette, 0, sizeof(m_palette));
+- m_strm.getBytes( m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
++ CV_Assert(clrused < 256);
++ memset(m_palette, 0, sizeof(m_palette));
++ m_strm.getBytes(m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
+ iscolor = IsColorPalette( m_palette, m_bpp );
+ }
+ else if( m_bpp == 16 && m_rle_code == BMP_BITFIELDS )
+@@ -290,7 +291,9 @@ bool BmpDecoder::readData( Mat& img )
+ else if( code > 2 ) // absolute mode
+ {
+ if( data + code*nch > line_end ) goto decode_rle4_bad;
+- m_strm.getBytes( src, (((code + 1)>>1) + 1) & -2 );
++ int sz = (((code + 1)>>1) + 1) & (~1);
++ CV_Assert((size_t)sz < _src.size());
++ m_strm.getBytes(src, sz);
+ if( color )
+ data = FillColorRow4( data, src, code, m_palette );
+ else
+@@ -379,7 +382,9 @@ decode_rle4_bad: ;
+
+ if( data + code3 > line_end )
+ goto decode_rle8_bad;
+- m_strm.getBytes( src, (code + 1) & -2 );
++ int sz = (code + 1) & (~1);
++ CV_Assert((size_t)sz < _src.size());
++ m_strm.getBytes(src, sz);
+ if( color )
+ data = FillColorRow8( data, src, code, m_palette );
+ else
+diff --git a/modules/imgcodecs/src/grfmt_pxm.cpp b/modules/imgcodecs/src/grfmt_pxm.cpp
+index 1750cb705..68bd8fd93 100644
+--- a/modules/imgcodecs/src/grfmt_pxm.cpp
++++ b/modules/imgcodecs/src/grfmt_pxm.cpp
+@@ -43,50 +43,58 @@
+ #include "precomp.hpp"
+ #include "utils.hpp"
+ #include "grfmt_pxm.hpp"
++#include <iostream>
+
+ namespace cv
+ {
+
+ ///////////////////////// P?M reader //////////////////////////////
+
+-static int ReadNumber( RLByteStream& strm, int maxdigits )
++static int ReadNumber(RLByteStream& strm, int maxdigits = 0)
+ {
+ int code;
+- int val = 0;
++ int64 val = 0;
+ int digits = 0;
+
+ code = strm.getByte();
+
+- if( !isdigit(code))
++ while (!isdigit(code))
+ {
+- do
++ if (code == '#' )
+ {
+- if( code == '#' )
++ do
+ {
+- do
+- {
+- code = strm.getByte();
+- }
+- while( code != '\n' && code != '\r' );
++ code = strm.getByte();
+ }
+-
++ while (code != '\n' && code != '\r');
+ code = strm.getByte();
+-
+- while( isspace(code))
++ }
++ else if (isspace(code))
++ {
++ while (isspace(code))
+ code = strm.getByte();
+ }
+- while( !isdigit( code ));
++ else
++ {
++#if 1
++ CV_ErrorNoReturn_(Error::StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code));
++#else
++ code = strm.getByte();
++#endif
++ }
+ }
+
+ do
+ {
+- val = val*10 + code - '0';
+- if( ++digits >= maxdigits ) break;
++ val = val*10 + (code - '0');
++ CV_Assert(val <= INT_MAX && "PXM: ReadNumber(): result is too large");
++ digits++;
++ if (maxdigits != 0 && digits >= maxdigits) break;
+ code = strm.getByte();
+ }
+- while( isdigit(code));
++ while (isdigit(code));
+
+- return val;
++ return (int)val;
+ }
+
+
+@@ -122,13 +130,13 @@ ImageDecoder PxMDecoder::newDecoder() const
+ return makePtr<PxMDecoder>();
+ }
+
+-void PxMDecoder::close()
++void PxMDecoder::close()
+ {
+ m_strm.close();
+ }
+
+
+-bool PxMDecoder::readHeader()
++bool PxMDecoder::readHeader()
+ {
+ bool result = false;
+
+@@ -158,10 +166,10 @@ bool PxMDecoder::readHeader()
+ m_binary = code >= '4';
+ m_type = m_bpp > 8 ? CV_8UC3 : CV_8UC1;
+
+- m_width = ReadNumber( m_strm, INT_MAX );
+- m_height = ReadNumber( m_strm, INT_MAX );
++ m_width = ReadNumber(m_strm);
++ m_height = ReadNumber(m_strm);
+
+- m_maxval = m_bpp == 1 ? 1 : ReadNumber( m_strm, INT_MAX );
++ m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm);
+ if( m_maxval > 65535 )
+ throw RBS_BAD_HEADER;
+
+@@ -175,8 +183,14 @@ bool PxMDecoder::readHeader()
+ result = true;
+ }
+ }
+- catch(...)
++ catch (const cv::Exception&)
++ {
++ throw;
++ }
++ catch (...)
+ {
++ std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
++ throw;
+ }
+
+ if( !result )
+@@ -189,33 +203,28 @@ bool PxMDecoder::readHeader()
+ }
+
+
+-bool PxMDecoder::readData( Mat& img )
++bool PxMDecoder::readData( Mat& img )
+ {
+ int color = img.channels() > 1;
+ uchar* data = img.ptr();
+ PaletteEntry palette[256];
+ bool result = false;
+- int bit_depth = CV_ELEM_SIZE1(m_type)*8;
+- int src_pitch = (m_width*m_bpp*bit_depth/8 + 7)/8;
++ const int bit_depth = CV_ELEM_SIZE1(m_type)*8;
++ const int src_pitch = divUp(m_width*m_bpp*(bit_depth/8), 8);
+ int nch = CV_MAT_CN(m_type);
+ int width3 = m_width*nch;
+- int i, x, y;
+
+ if( m_offset < 0 || !m_strm.isOpened())
+ return false;
+
+- AutoBuffer<uchar> _src(src_pitch + 32);
+- uchar* src = _src;
+- AutoBuffer<uchar> _gray_palette;
+- uchar* gray_palette = _gray_palette;
++ uchar gray_palette[256] = {0};
+
+ // create LUT for converting colors
+ if( bit_depth == 8 )
+ {
+- _gray_palette.allocate(m_maxval + 1);
+- gray_palette = _gray_palette;
++ CV_Assert(m_maxval < 256);
+
+- for( i = 0; i <= m_maxval; i++ )
++ for (int i = 0; i <= m_maxval; i++)
+ gray_palette[i] = (uchar)((i*255/m_maxval)^(m_bpp == 1 ? 255 : 0));
+
+ FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 );
+@@ -229,12 +238,16 @@ bool PxMDecoder::readData( Mat& img )
+ {
+ ////////////////////////// 1 BPP /////////////////////////
+ case 1:
++ CV_Assert(CV_MAT_DEPTH(m_type) == CV_8U);
+ if( !m_binary )
+ {
+- for( y = 0; y < m_height; y++, data += img.step )
++ AutoBuffer<uchar> _src(m_width);
++ uchar* src = _src;
++
++ for (int y = 0; y < m_height; y++, data += img.step)
+ {
+- for( x = 0; x < m_width; x++ )
+- src[x] = ReadNumber( m_strm, 1 ) != 0;
++ for (int x = 0; x < m_width; x++)
++ src[x] = ReadNumber(m_strm, 1) != 0;
+
+ if( color )
+ FillColorRow8( data, src, m_width, palette );
+@@ -244,7 +257,10 @@ bool PxMDecoder::readData( Mat& img )
+ }
+ else
+ {
+- for( y = 0; y < m_height; y++, data += img.step )
++ AutoBuffer<uchar> _src(src_pitch);
++ uchar* src = _src;
++
++ for (int y = 0; y < m_height; y++, data += img.step)
+ {
+ m_strm.getBytes( src, src_pitch );
+
+@@ -260,13 +276,17 @@ bool PxMDecoder::readData( Mat& img )
+ ////////////////////////// 8 BPP /////////////////////////
+ case 8:
+ case 24:
+- for( y = 0; y < m_height; y++, data += img.step )
++ {
++ AutoBuffer<uchar> _src(std::max<size_t>(width3*2, src_pitch));
++ uchar* src = _src;
++
++ for (int y = 0; y < m_height; y++, data += img.step)
+ {
+ if( !m_binary )
+ {
+- for( x = 0; x < width3; x++ )
++ for (int x = 0; x < width3; x++)
+ {
+- int code = ReadNumber( m_strm, INT_MAX );
++ int code = ReadNumber(m_strm);
+ if( (unsigned)code > (unsigned)m_maxval ) code = m_maxval;
+ if( bit_depth == 8 )
+ src[x] = gray_palette[code];
+@@ -279,7 +299,7 @@ bool PxMDecoder::readData( Mat& img )
+ m_strm.getBytes( src, src_pitch );
+ if( bit_depth == 16 && !isBigEndian() )
+ {
+- for( x = 0; x < width3; x++ )
++ for (int x = 0; x < width3; x++)
+ {
+ uchar v = src[x * 2];
+ src[x * 2] = src[x * 2 + 1];
+@@ -290,7 +310,7 @@ bool PxMDecoder::readData( Mat& img )
+
+ if( img.depth() == CV_8U && bit_depth == 16 )
+ {
+- for( x = 0; x < width3; x++ )
++ for (int x = 0; x < width3; x++)
+ {
+ int v = ((ushort *)src)[x];
+ src[x] = (uchar)(v >> 8);
+@@ -331,12 +351,19 @@ bool PxMDecoder::readData( Mat& img )
+ }
+ result = true;
+ break;
++ }
+ default:
+- assert(0);
++ CV_ErrorNoReturn(Error::StsError, "m_bpp is not supported");
+ }
+ }
+- catch(...)
++ catch (const cv::Exception&)
++ {
++ throw;
++ }
++ catch (...)
+ {
++ std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
++ throw;
+ }
+
+ return result;
+@@ -412,8 +439,9 @@ bool PxMEncoder::write( const Mat& img, const std::vector<int>& params )
+ char* buffer = _buffer;
+
+ // write header;
+- sprintf( buffer, "P%c\n%d %d\n%d\n",
++ sprintf( buffer, "P%c\n# Generated by OpenCV %s\n%d %d\n%d\n",
+ '2' + (channels > 1 ? 1 : 0) + (isBinary ? 3 : 0),
++ CV_VERSION,
+ width, height, (1 << depth) - 1 );
+
+ strm.putBytes( buffer, (int)strlen(buffer) );
+diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp
+index 3b2366217..5ee4ca354 100644
+--- a/modules/imgcodecs/src/loadsave.cpp
++++ b/modules/imgcodecs/src/loadsave.cpp
+@@ -55,6 +55,27 @@
+ /****************************************************************************************\
+ * Image Codecs *
+ \****************************************************************************************/
++
++namespace cv {
++
++// TODO Add runtime configuration
++#define CV_IO_MAX_IMAGE_PARAMS (50)
++#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
++#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
++#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
++
++static Size validateInputImageSize(const Size& size)
++{
++ CV_Assert(size.width > 0);
++ CV_Assert(size.width <= CV_IO_MAX_IMAGE_WIDTH);
++ CV_Assert(size.height > 0);
++ CV_Assert(size.height <= CV_IO_MAX_IMAGE_HEIGHT);
++ uint64 pixels = (uint64)size.width * (uint64)size.height;
++ CV_Assert(pixels <= CV_IO_MAX_IMAGE_PIXELS);
++ return size;
++}
++
++
+ namespace {
+
+ class ByteStreamBuffer: public std::streambuf
+@@ -94,9 +115,6 @@ protected:
+
+ }
+
+-namespace cv
+-{
+-
+ /**
+ * @struct ImageCodecInitializer
+ *
+@@ -408,14 +426,26 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
+ /// set the filename in the driver
+ decoder->setSource( filename );
+
+- // read the header to make sure it succeeds
+- if( !decoder->readHeader() )
++ try
++ {
++ // read the header to make sure it succeeds
++ if( !decoder->readHeader() )
++ return 0;
++ }
++ catch (const cv::Exception& e)
++ {
++ std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
+ return 0;
++ }
++ catch (...)
++ {
++ std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++ return 0;
++ }
++
+
+ // established the required input image size
+- CvSize size;
+- size.width = decoder->width();
+- size.height = decoder->height();
++ Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
+
+ // grab the decoded type
+ int type = decoder->type();
+@@ -451,7 +481,21 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
+ }
+
+ // read the image data
+- if( !decoder->readData( *data ))
++ bool success = false;
++ try
++ {
++ if (decoder->readData(*data))
++ success = true;
++ }
++ catch (const cv::Exception& e)
++ {
++ std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++ }
++ catch (...)
++ {
++ std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++ }
++ if (!success)
+ {
+ cvReleaseImage( &image );
+ cvReleaseMat( &matrix );
+@@ -504,8 +548,22 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
+ decoder->setSource(filename);
+
+ // read the header to make sure it succeeds
+- if (!decoder->readHeader())
++ try
++ {
++ // read the header to make sure it succeeds
++ if( !decoder->readHeader() )
++ return 0;
++ }
++ catch (const cv::Exception& e)
++ {
++ std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
+ return 0;
++ }
++ catch (...)
++ {
++ std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++ return 0;
++ }
+
+ for (;;)
+ {
+@@ -523,17 +581,32 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
+ type = CV_MAKETYPE(CV_MAT_DEPTH(type), 1);
+ }
+
++ // established the required input image size
++ Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
++
+ // read the image data
+- Mat mat(decoder->height(), decoder->width(), type);
+- if (!decoder->readData(mat))
++ Mat mat(size.height, size.width, type);
++ bool success = false;
++ try
+ {
+- // optionally rotate the data if EXIF' orientation flag says so
+- if( (flags & IMREAD_IGNORE_ORIENTATION) == 0 && flags != IMREAD_UNCHANGED )
+- {
+- ApplyExifOrientation(filename, mat);
+- }
+-
++ if (decoder->readData(mat))
++ success = true;
++ }
++ catch (const cv::Exception& e)
++ {
++ std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++ }
++ catch (...)
++ {
++ std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++ }
++ if (!success)
+ break;
++
++ // optionally rotate the data if EXIF' orientation flag says so
++ if( (flags & IMREAD_IGNORE_ORIENTATION) == 0 && flags != IMREAD_UNCHANGED )
++ {
++ ApplyExifOrientation(filename, mat);
+ }
+
+ mats.push_back(mat);
+@@ -616,6 +689,7 @@ static bool imwrite_( const String& filename, const Mat& image,
+ }
+
+ encoder->setDestination( filename );
++ CV_Assert(params.size() <= CV_IO_MAX_IMAGE_PARAMS*2);
+ bool code = encoder->write( *pimage, params );
+
+ // CV_Assert( code );
+@@ -663,22 +737,35 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
+ decoder->setSource(filename);
+ }
+
+- if( !decoder->readHeader() )
++ bool success = false;
++ try
++ {
++ if (decoder->readHeader())
++ success = true;
++ }
++ catch (const cv::Exception& e)
++ {
++ std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
++ }
++ catch (...)
++ {
++ std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++ }
++ if (!success)
+ {
+ decoder.release();
+- if ( !filename.empty() )
++ if (!filename.empty())
+ {
+- if ( remove(filename.c_str()) != 0 )
++ if (0 != remove(filename.c_str()))
+ {
+- CV_Error( CV_StsError, "unable to remove temporary file" );
++ std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
+ }
+ }
+ return 0;
+ }
+
+- CvSize size;
+- size.width = decoder->width();
+- size.height = decoder->height();
++ // established the required input image size
++ Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
+
+ int type = decoder->type();
+ if( (flags & IMREAD_LOAD_GDAL) != IMREAD_LOAD_GDAL && flags != IMREAD_UNCHANGED )
+@@ -712,17 +799,30 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
+ temp = cvarrToMat(image);
+ }
+
+- bool code = decoder->readData( *data );
++ success = false;
++ try
++ {
++ if (decoder->readData(*data))
++ success = true;
++ }
++ catch (const cv::Exception& e)
++ {
++ std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++ }
++ catch (...)
++ {
++ std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++ }
+ decoder.release();
+- if ( !filename.empty() )
++ if (!filename.empty())
+ {
+- if ( remove(filename.c_str()) != 0 )
++ if (0 != remove(filename.c_str()))
+ {
+- CV_Error( CV_StsError, "unable to remove temporary file" );
++ std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
+ }
+ }
+
+- if( !code )
++ if (!success)
+ {
+ cvReleaseImage( &image );
+ cvReleaseMat( &matrix );
+@@ -859,7 +959,7 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
+ if( _params )
+ {
+ for( ; _params[i] > 0; i += 2 )
+- ;
++ CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
+ }
+ return cv::imwrite_(filename, cv::cvarrToMat(arr),
+ i > 0 ? std::vector<int>(_params, _params+i) : std::vector<int>(),
+@@ -890,7 +990,7 @@ cvEncodeImage( const char* ext, const CvArr* arr, const int* _params )
+ if( _params )
+ {
+ for( ; _params[i] > 0; i += 2 )
+- ;
++ CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
+ }
+ cv::Mat img = cv::cvarrToMat(arr);
+ if( CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL )
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch
new file mode 100644
index 000000000..a22b04a90
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-To-fix-errors-as-following.patch
@@ -0,0 +1,80 @@
+From ace48a628dca34d742615598afeef42ed323a029 Mon Sep 17 00:00:00 2001
+From: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
+Date: Fri, 19 May 2017 04:27:50 +0900
+Subject: [PATCH 3/3] To fix errors as following:
+
+"test_main.cpp:45: undefined reference to `parseCustomOptions(int, char**)'"
+"perf_abs.cpp:13: undefined reference to `cvtest::param_seed'"
+"test_superres.cpp:270: undefined reference to `checkIppStatus()'"
+
+Signed-off-by: Huang Qiyu <huangqy.fnst@cn.fujitsu.com>
+
+Also add the visibility changes for certain OpenCL-related functions in
+ts module.
+
+Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
+---
+ modules/ts/include/opencv2/ts.hpp | 6 +++---
+ modules/ts/include/opencv2/ts/ocl_test.hpp | 2 +-
+ modules/ts/include/opencv2/ts/ts_ext.hpp | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp
+index 41a76b13e..205646140 100644
+--- a/modules/ts/include/opencv2/ts.hpp
++++ b/modules/ts/include/opencv2/ts.hpp
+@@ -555,7 +555,7 @@ protected:
+ }
+ };
+
+-extern uint64 param_seed;
++CV_EXPORTS extern uint64 param_seed;
+
+ struct CV_EXPORTS DefaultRngAuto
+ {
+@@ -611,14 +611,14 @@ CV_EXPORTS std::string findDataFile(const std::string& relative_path, bool requi
+
+ #ifdef HAVE_OPENCL
+ namespace ocl {
+-void dumpOpenCLDevice();
++CV_EXPORTS void dumpOpenCLDevice();
+ }
+ #define TEST_DUMP_OCL_INFO cvtest::ocl::dumpOpenCLDevice();
+ #else
+ #define TEST_DUMP_OCL_INFO
+ #endif
+
+-void parseCustomOptions(int argc, char **argv);
++CV_EXPORTS void parseCustomOptions(int argc, char **argv);
+
+ #define CV_TEST_INIT0_NOOP (void)0
+
+diff --git a/modules/ts/include/opencv2/ts/ocl_test.hpp b/modules/ts/include/opencv2/ts/ocl_test.hpp
+index 54b33ece8..ef56bf9ef 100644
+--- a/modules/ts/include/opencv2/ts/ocl_test.hpp
++++ b/modules/ts/include/opencv2/ts/ocl_test.hpp
+@@ -82,7 +82,7 @@ inline UMat ToUMat(InputArray src)
+ return dst;
+ }
+
+-extern int test_loop_times;
++CV_EXPORTS extern int test_loop_times;
+
+ #define MAX_VALUE 357
+
+diff --git a/modules/ts/include/opencv2/ts/ts_ext.hpp b/modules/ts/include/opencv2/ts/ts_ext.hpp
+index 0bdd346dd..2cd34dfce 100644
+--- a/modules/ts/include/opencv2/ts/ts_ext.hpp
++++ b/modules/ts/include/opencv2/ts/ts_ext.hpp
+@@ -9,7 +9,7 @@
+ #define OPENCV_TS_EXT_HPP
+
+ namespace cvtest {
+-void checkIppStatus();
++CV_EXPORTS void checkIppStatus();
+ }
+
+ #define CV_TEST_INIT \
+--
+2.13.4
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-imgproc-test-add-checks-for-remove-call.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-imgproc-test-add-checks-for-remove-call.patch
new file mode 100644
index 000000000..5f4a60c96
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/0003-imgproc-test-add-checks-for-remove-call.patch
@@ -0,0 +1,186 @@
+Upstream-Status: Backport [https://github.com/opencv/opencv/pull/9376/commits/78a310630fb0a1f6d089576202343e672f27609d]
+
+Fix CVEs for opencv 3.3.
+
+* CVE-2017-12597
+* CVE-2017-12598
+* CVE-2017-12599
+* CVE-2017-12600
+* CVE-2017-12601
+* CVE-2017-12602
+* CVE-2017-12603
+* CVE-2017-12604
+* CVE-2017-12605
+* CVE-2017-12606
+* CVE-2017-12862
+* CVE-2017-12863
+* CVE-2017-12864
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+From 78a310630fb0a1f6d089576202343e672f27609d Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@intel.com>
+Date: Wed, 16 Aug 2017 13:53:12 +0300
+Subject: [PATCH 3/3] imgproc(test): add checks for remove() call
+
+---
+ modules/imgcodecs/test/test_grfmt.cpp | 2 +-
+ modules/imgcodecs/test/test_jpeg.cpp | 12 ++++++------
+ modules/imgcodecs/test/test_png.cpp | 2 +-
+ modules/imgcodecs/test/test_read_write.cpp | 4 ++--
+ modules/imgcodecs/test/test_tiff.cpp | 8 ++++----
+ modules/imgcodecs/test/test_webp.cpp | 6 +++---
+ 6 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/modules/imgcodecs/test/test_grfmt.cpp b/modules/imgcodecs/test/test_grfmt.cpp
+index 64a0c1e3a..74b72c3b3 100644
+--- a/modules/imgcodecs/test/test_grfmt.cpp
++++ b/modules/imgcodecs/test/test_grfmt.cpp
+@@ -175,7 +175,7 @@ TEST_P(Imgcodecs_ExtSize, write_imageseq)
+ EXPECT_LT(n, 1.);
+ EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), img, img_gt);
+ }
+- remove(filename.c_str());
++ EXPECT_EQ(0, remove(filename.c_str()));
+ }
+ }
+
+diff --git a/modules/imgcodecs/test/test_jpeg.cpp b/modules/imgcodecs/test/test_jpeg.cpp
+index 5546f2d91..6ddb02840 100644
+--- a/modules/imgcodecs/test/test_jpeg.cpp
++++ b/modules/imgcodecs/test/test_jpeg.cpp
+@@ -123,8 +123,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_progressive_jpeg)
+
+ EXPECT_EQ(0, cvtest::norm(img_jpg_progressive, img_jpg_normal, NORM_INF));
+
+- remove(output_progressive.c_str());
+- remove(output_normal.c_str());
++ EXPECT_EQ(0, remove(output_progressive.c_str()));
++ EXPECT_EQ(0, remove(output_normal.c_str()));
+ }
+
+ TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg)
+@@ -148,8 +148,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg)
+
+ EXPECT_EQ(0, cvtest::norm(img_jpg_optimized, img_jpg_normal, NORM_INF));
+
+- remove(output_optimized.c_str());
+- remove(output_normal.c_str());
++ EXPECT_EQ(0, remove(output_optimized.c_str()));
++ EXPECT_EQ(0, remove(output_normal.c_str()));
+ }
+
+ TEST(Imgcodecs_Jpeg, encode_decode_rst_jpeg)
+@@ -173,8 +173,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_rst_jpeg)
+
+ EXPECT_EQ(0, cvtest::norm(img_jpg_rst, img_jpg_normal, NORM_INF));
+
+- remove(output_rst.c_str());
+- remove(output_normal.c_str());
++ EXPECT_EQ(0, remove(output_rst.c_str()));
++ EXPECT_EQ(0, remove(output_normal.c_str()));
+ }
+
+ #endif // HAVE_JPEG
+diff --git a/modules/imgcodecs/test/test_png.cpp b/modules/imgcodecs/test/test_png.cpp
+index c46f90119..4e97043e1 100644
+--- a/modules/imgcodecs/test/test_png.cpp
++++ b/modules/imgcodecs/test/test_png.cpp
+@@ -17,7 +17,7 @@ TEST(Imgcodecs_Png, write_big)
+ EXPECT_EQ(13043, img.cols);
+ EXPECT_EQ(13917, img.rows);
+ ASSERT_NO_THROW(imwrite(dst_file, img));
+- remove(dst_file.c_str());
++ EXPECT_EQ(0, remove(dst_file.c_str()));
+ }
+
+ TEST(Imgcodecs_Png, encode)
+diff --git a/modules/imgcodecs/test/test_read_write.cpp b/modules/imgcodecs/test/test_read_write.cpp
+index 38f10225f..5119813bf 100644
+--- a/modules/imgcodecs/test/test_read_write.cpp
++++ b/modules/imgcodecs/test/test_read_write.cpp
+@@ -50,7 +50,7 @@ TEST(Imgcodecs_Image, read_write_bmp)
+ psnr = cvtest::PSNR(buf_loaded, image);
+ EXPECT_GT(psnr, thresDbell);
+
+- remove(dst_name.c_str());
++ EXPECT_EQ(0, remove(dst_name.c_str()));
+ }
+ }
+
+@@ -95,7 +95,7 @@ TEST_P(Imgcodecs_Image, read_write)
+ psnr = cvtest::PSNR(buf_loaded, image);
+ EXPECT_GT(psnr, thresDbell);
+
+- remove(full_name.c_str());
++ EXPECT_EQ(0, remove(full_name.c_str()));
+ }
+
+ const string exts[] = {
+diff --git a/modules/imgcodecs/test/test_tiff.cpp b/modules/imgcodecs/test/test_tiff.cpp
+index 0264da4cd..6ef0c1748 100644
+--- a/modules/imgcodecs/test/test_tiff.cpp
++++ b/modules/imgcodecs/test/test_tiff.cpp
+@@ -41,8 +41,8 @@ TEST(Imgcodecs_Tiff, decode_tile16384x16384)
+ // not enough memory
+ }
+
+- remove(file3.c_str());
+- remove(file4.c_str());
++ EXPECT_EQ(0, remove(file3.c_str()));
++ EXPECT_EQ(0, remove(file4.c_str()));
+ }
+
+ TEST(Imgcodecs_Tiff, write_read_16bit_big_little_endian)
+@@ -88,7 +88,7 @@ TEST(Imgcodecs_Tiff, write_read_16bit_big_little_endian)
+ EXPECT_EQ(0xDEAD, img.at<ushort>(0,0));
+ EXPECT_EQ(0xBEEF, img.at<ushort>(0,1));
+
+- remove(filename.c_str());
++ EXPECT_EQ(0, remove(filename.c_str()));
+ }
+ }
+
+@@ -143,7 +143,7 @@ TEST(Imgcodecs_Tiff, decode_infinite_rowsperstrip)
+
+ EXPECT_NO_THROW(cv::imread(filename, IMREAD_UNCHANGED));
+
+- remove(filename.c_str());
++ EXPECT_EQ(0, remove(filename.c_str()));
+ }
+
+ //==================================================================================================
+diff --git a/modules/imgcodecs/test/test_webp.cpp b/modules/imgcodecs/test/test_webp.cpp
+index 6d40ce21e..d82fdd289 100644
+--- a/modules/imgcodecs/test/test_webp.cpp
++++ b/modules/imgcodecs/test/test_webp.cpp
+@@ -44,7 +44,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+ }
+ }
+
+- remove(output.c_str());
++ EXPECT_EQ(0, remove(output.c_str()));
+
+ cv::Mat decode = cv::imdecode(buf, IMREAD_COLOR);
+ ASSERT_FALSE(decode.empty());
+@@ -71,7 +71,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossy_webp)
+
+ EXPECT_NO_THROW(cv::imwrite(output, img, params));
+ cv::Mat img_webp = cv::imread(output);
+- remove(output.c_str());
++ EXPECT_EQ(0, remove(output.c_str()));
+ EXPECT_FALSE(img_webp.empty());
+ EXPECT_EQ(3, img_webp.channels());
+ EXPECT_EQ(512, img_webp.cols);
+@@ -96,7 +96,7 @@ TEST(Imgcodecs_WebP, encode_decode_with_alpha_webp)
+
+ EXPECT_NO_THROW(cv::imwrite(output, img));
+ cv::Mat img_webp = cv::imread(output);
+- remove(output.c_str());
++ EXPECT_EQ(0, remove(output.c_str()));
+ EXPECT_FALSE(img_webp.empty());
+ EXPECT_EQ(4, img_webp.channels());
+ EXPECT_EQ(512, img_webp.cols);
+--
+2.14.1
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/CVE-2017-14136.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/CVE-2017-14136.patch
new file mode 100644
index 000000000..7ad50a2d2
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/CVE-2017-14136.patch
@@ -0,0 +1,288 @@
+Upstream-Status: Backport [https://github.com/opencv/opencv/pull/9448/commits/aacae20]
+
+Backport patch to fix CVE-2017-14136.
+
+Ref: https://github.com/opencv/opencv/issues/9443
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+From aacae2065744adb05e858d327198c7bbe7f452b0 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@intel.com>
+Date: Wed, 23 Aug 2017 15:15:27 +0300
+Subject: [PATCH] imgcodesc: fix code problems with integer overflow / address
+ arithmetic / UB
+
+---
+ modules/imgcodecs/src/grfmt_bmp.cpp | 8 ++---
+ modules/imgcodecs/src/grfmt_exr.cpp | 10 +++----
+ modules/imgcodecs/src/grfmt_jpeg.cpp | 2 +-
+ modules/imgcodecs/src/grfmt_jpeg2000.cpp | 6 ++--
+ modules/imgcodecs/src/grfmt_pam.cpp | 2 +-
+ modules/imgcodecs/src/grfmt_sunras.cpp | 6 ++--
+ modules/imgcodecs/src/utils.cpp | 51 +++++++++++++++++++-------------
+ modules/imgcodecs/src/utils.hpp | 2 ++
+ 8 files changed, 50 insertions(+), 37 deletions(-)
+
+diff --git a/modules/imgcodecs/src/grfmt_bmp.cpp b/modules/imgcodecs/src/grfmt_bmp.cpp
+index 257f97c2d8b..69768e276a3 100644
+--- a/modules/imgcodecs/src/grfmt_bmp.cpp
++++ b/modules/imgcodecs/src/grfmt_bmp.cpp
+@@ -193,7 +193,7 @@ bool BmpDecoder::readHeader()
+ bool BmpDecoder::readData( Mat& img )
+ {
+ uchar* data = img.ptr();
+- int step = (int)img.step;
++ int step = validateToInt(img.step);
+ bool color = img.channels() > 1;
+ uchar gray_palette[256] = {0};
+ bool result = false;
+@@ -206,7 +206,7 @@ bool BmpDecoder::readData( Mat& img )
+
+ if( m_origin == IPL_ORIGIN_BL )
+ {
+- data += (m_height - 1)*step;
++ data += (m_height - 1)*(size_t)step;
+ step = -step;
+ }
+
+@@ -530,7 +530,7 @@ bool BmpEncoder::write( const Mat& img, const std::vector<int>& )
+ int bitmapHeaderSize = 40;
+ int paletteSize = channels > 1 ? 0 : 1024;
+ int headerSize = 14 /* fileheader */ + bitmapHeaderSize + paletteSize;
+- int fileSize = fileStep*height + headerSize;
++ size_t fileSize = (size_t)fileStep*height + headerSize;
+ PaletteEntry palette[256];
+
+ if( m_buf )
+@@ -540,7 +540,7 @@ bool BmpEncoder::write( const Mat& img, const std::vector<int>& )
+ strm.putBytes( fmtSignBmp, (int)strlen(fmtSignBmp) );
+
+ // write file header
+- strm.putDWord( fileSize ); // file size
++ strm.putDWord( validateToInt(fileSize) ); // file size
+ strm.putDWord( 0 );
+ strm.putDWord( headerSize );
+
+diff --git a/modules/imgcodecs/src/grfmt_exr.cpp b/modules/imgcodecs/src/grfmt_exr.cpp
+index 0d2ae9fa7d2..78ffe6c7668 100644
+--- a/modules/imgcodecs/src/grfmt_exr.cpp
++++ b/modules/imgcodecs/src/grfmt_exr.cpp
+@@ -195,7 +195,7 @@ bool ExrDecoder::readData( Mat& img )
+ bool color = img.channels() > 1;
+
+ uchar* data = img.ptr();
+- int step = img.step;
++ size_t step = img.step;
+ bool justcopy = m_native_depth;
+ bool chromatorgb = false;
+ bool rgbtogray = false;
+@@ -203,8 +203,8 @@ bool ExrDecoder::readData( Mat& img )
+ FrameBuffer frame;
+ int xsample[3] = {1, 1, 1};
+ char *buffer;
+- int xstep;
+- int ystep;
++ size_t xstep = 0;
++ size_t ystep = 0;
+
+ xstep = m_native_depth ? 4 : 1;
+
+@@ -593,7 +593,7 @@ bool ExrEncoder::write( const Mat& img, const std::vector<int>& )
+ bool issigned = depth == CV_8S || depth == CV_16S || depth == CV_32S;
+ bool isfloat = depth == CV_32F || depth == CV_64F;
+ depth = CV_ELEM_SIZE1(depth)*8;
+- const int step = img.step;
++ const size_t step = img.step;
+
+ Header header( width, height );
+ Imf::PixelType type;
+@@ -623,7 +623,7 @@ bool ExrEncoder::write( const Mat& img, const std::vector<int>& )
+ FrameBuffer frame;
+
+ char *buffer;
+- int bufferstep;
++ size_t bufferstep;
+ int size;
+ if( type == FLOAT && depth == 32 )
+ {
+diff --git a/modules/imgcodecs/src/grfmt_jpeg.cpp b/modules/imgcodecs/src/grfmt_jpeg.cpp
+index ce942ca1995..caf768d2569 100644
+--- a/modules/imgcodecs/src/grfmt_jpeg.cpp
++++ b/modules/imgcodecs/src/grfmt_jpeg.cpp
+@@ -396,7 +396,7 @@ int my_jpeg_load_dht (struct jpeg_decompress_struct *info, unsigned char *dht,
+ bool JpegDecoder::readData( Mat& img )
+ {
+ volatile bool result = false;
+- int step = (int)img.step;
++ size_t step = img.step;
+ bool color = img.channels() > 1;
+
+ if( m_state && m_width && m_height )
+diff --git a/modules/imgcodecs/src/grfmt_jpeg2000.cpp b/modules/imgcodecs/src/grfmt_jpeg2000.cpp
+index 950ec21375f..24dfb38bb9d 100644
+--- a/modules/imgcodecs/src/grfmt_jpeg2000.cpp
++++ b/modules/imgcodecs/src/grfmt_jpeg2000.cpp
+@@ -156,7 +156,7 @@ bool Jpeg2KDecoder::readData( Mat& img )
+ bool result = false;
+ int color = img.channels() > 1;
+ uchar* data = img.ptr();
+- int step = (int)img.step;
++ size_t step = img.step;
+ jas_stream_t* stream = (jas_stream_t*)m_stream;
+ jas_image_t* image = (jas_image_t*)m_image;
+
+@@ -252,9 +252,9 @@ bool Jpeg2KDecoder::readData( Mat& img )
+ if( !jas_image_readcmpt( image, cmptlut[i], 0, 0, xend / xstep, yend / ystep, buffer ))
+ {
+ if( img.depth() == CV_8U )
+- result = readComponent8u( data + i, buffer, step, cmptlut[i], maxval, offset, ncmpts );
++ result = readComponent8u( data + i, buffer, validateToInt(step), cmptlut[i], maxval, offset, ncmpts );
+ else
+- result = readComponent16u( ((unsigned short *)data) + i, buffer, step / 2, cmptlut[i], maxval, offset, ncmpts );
++ result = readComponent16u( ((unsigned short *)data) + i, buffer, validateToInt(step / 2), cmptlut[i], maxval, offset, ncmpts );
+ if( !result )
+ {
+ i = ncmpts;
+diff --git a/modules/imgcodecs/src/grfmt_pam.cpp b/modules/imgcodecs/src/grfmt_pam.cpp
+index 11195dc342c..8eb9e012309 100644
+--- a/modules/imgcodecs/src/grfmt_pam.cpp
++++ b/modules/imgcodecs/src/grfmt_pam.cpp
+@@ -479,7 +479,7 @@ bool PAMDecoder::readData( Mat& img )
+ {
+ uchar* data = img.ptr();
+ int target_channels = img.channels();
+- int imp_stride = (int)img.step;
++ size_t imp_stride = img.step;
+ int sample_depth = CV_ELEM_SIZE1(m_type);
+ int src_elems_per_row = m_width*m_channels;
+ int src_stride = src_elems_per_row*sample_depth;
+diff --git a/modules/imgcodecs/src/grfmt_sunras.cpp b/modules/imgcodecs/src/grfmt_sunras.cpp
+index aca9b369318..6d448f94ed3 100644
+--- a/modules/imgcodecs/src/grfmt_sunras.cpp
++++ b/modules/imgcodecs/src/grfmt_sunras.cpp
+@@ -160,7 +160,7 @@ bool SunRasterDecoder::readData( Mat& img )
+ {
+ int color = img.channels() > 1;
+ uchar* data = img.ptr();
+- int step = (int)img.step;
++ size_t step = img.step;
+ uchar gray_palette[256] = {0};
+ bool result = false;
+ int src_pitch = ((m_width*m_bpp + 7)/8 + 1) & -2;
+@@ -308,11 +308,11 @@ bool SunRasterDecoder::readData( Mat& img )
+ code = m_strm.getByte();
+
+ if( color )
+- data = FillUniColor( data, line_end, step, width3,
++ data = FillUniColor( data, line_end, validateToInt(step), width3,
+ y, m_height, len,
+ m_palette[code] );
+ else
+- data = FillUniGray( data, line_end, step, width3,
++ data = FillUniGray( data, line_end, validateToInt(step), width3,
+ y, m_height, len,
+ gray_palette[code] );
+ if( y >= m_height )
+diff --git a/modules/imgcodecs/src/utils.cpp b/modules/imgcodecs/src/utils.cpp
+index 2ee5bafc712..474dae008ca 100644
+--- a/modules/imgcodecs/src/utils.cpp
++++ b/modules/imgcodecs/src/utils.cpp
+@@ -42,6 +42,13 @@
+ #include "precomp.hpp"
+ #include "utils.hpp"
+
++int validateToInt(size_t sz)
++{
++ int valueInt = (int)sz;
++ CV_Assert((size_t)valueInt == sz);
++ return valueInt;
++}
++
+ #define SCALE 14
+ #define cR (int)(0.299*(1 << SCALE) + 0.5)
+ #define cG (int)(0.587*(1 << SCALE) + 0.5)
+@@ -537,23 +544,25 @@ uchar* FillColorRow1( uchar* data, uchar* indices, int len, PaletteEntry* palett
+ {
+ uchar* end = data + len*3;
+
++ const PaletteEntry p0 = palette[0], p1 = palette[1];
++
+ while( (data += 24) < end )
+ {
+ int idx = *indices++;
+- *((PaletteEntry*)(data - 24)) = palette[(idx & 128) != 0];
+- *((PaletteEntry*)(data - 21)) = palette[(idx & 64) != 0];
+- *((PaletteEntry*)(data - 18)) = palette[(idx & 32) != 0];
+- *((PaletteEntry*)(data - 15)) = palette[(idx & 16) != 0];
+- *((PaletteEntry*)(data - 12)) = palette[(idx & 8) != 0];
+- *((PaletteEntry*)(data - 9)) = palette[(idx & 4) != 0];
+- *((PaletteEntry*)(data - 6)) = palette[(idx & 2) != 0];
+- *((PaletteEntry*)(data - 3)) = palette[(idx & 1) != 0];
++ *((PaletteEntry*)(data - 24)) = (idx & 128) ? p1 : p0;
++ *((PaletteEntry*)(data - 21)) = (idx & 64) ? p1 : p0;
++ *((PaletteEntry*)(data - 18)) = (idx & 32) ? p1 : p0;
++ *((PaletteEntry*)(data - 15)) = (idx & 16) ? p1 : p0;
++ *((PaletteEntry*)(data - 12)) = (idx & 8) ? p1 : p0;
++ *((PaletteEntry*)(data - 9)) = (idx & 4) ? p1 : p0;
++ *((PaletteEntry*)(data - 6)) = (idx & 2) ? p1 : p0;
++ *((PaletteEntry*)(data - 3)) = (idx & 1) ? p1 : p0;
+ }
+
+- int idx = indices[0] << 24;
++ int idx = indices[0];
+ for( data -= 24; data < end; data += 3, idx += idx )
+ {
+- PaletteEntry clr = palette[idx < 0];
++ const PaletteEntry clr = (idx & 128) ? p1 : p0;
+ WRITE_PIX( data, clr );
+ }
+
+@@ -565,23 +574,25 @@ uchar* FillGrayRow1( uchar* data, uchar* indices, int len, uchar* palette )
+ {
+ uchar* end = data + len;
+
++ const uchar p0 = palette[0], p1 = palette[1];
++
+ while( (data += 8) < end )
+ {
+ int idx = *indices++;
+- *((uchar*)(data - 8)) = palette[(idx & 128) != 0];
+- *((uchar*)(data - 7)) = palette[(idx & 64) != 0];
+- *((uchar*)(data - 6)) = palette[(idx & 32) != 0];
+- *((uchar*)(data - 5)) = palette[(idx & 16) != 0];
+- *((uchar*)(data - 4)) = palette[(idx & 8) != 0];
+- *((uchar*)(data - 3)) = palette[(idx & 4) != 0];
+- *((uchar*)(data - 2)) = palette[(idx & 2) != 0];
+- *((uchar*)(data - 1)) = palette[(idx & 1) != 0];
++ *((uchar*)(data - 8)) = (idx & 128) ? p1 : p0;
++ *((uchar*)(data - 7)) = (idx & 64) ? p1 : p0;
++ *((uchar*)(data - 6)) = (idx & 32) ? p1 : p0;
++ *((uchar*)(data - 5)) = (idx & 16) ? p1 : p0;
++ *((uchar*)(data - 4)) = (idx & 8) ? p1 : p0;
++ *((uchar*)(data - 3)) = (idx & 4) ? p1 : p0;
++ *((uchar*)(data - 2)) = (idx & 2) ? p1 : p0;
++ *((uchar*)(data - 1)) = (idx & 1) ? p1 : p0;
+ }
+
+- int idx = indices[0] << 24;
++ int idx = indices[0];
+ for( data -= 8; data < end; data++, idx += idx )
+ {
+- data[0] = palette[idx < 0];
++ data[0] = (idx & 128) ? p1 : p0;
+ }
+
+ return data;
+diff --git a/modules/imgcodecs/src/utils.hpp b/modules/imgcodecs/src/utils.hpp
+index cab10609db2..7af4c6174ee 100644
+--- a/modules/imgcodecs/src/utils.hpp
++++ b/modules/imgcodecs/src/utils.hpp
+@@ -42,6 +42,8 @@
+ #ifndef _UTILS_H_
+ #define _UTILS_H_
+
++int validateToInt(size_t step);
++
+ struct PaletteEntry
+ {
+ unsigned char b, g, r, a;
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/already-exists.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/already-exists.patch
new file mode 100644
index 000000000..6e24f2de8
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/already-exists.patch
@@ -0,0 +1,394 @@
+From e4bf148cddf277834e57c9afeec8daff8378a655 Mon Sep 17 00:00:00 2001
+From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+Date: Wed, 22 Nov 2017 15:27:07 +0100
+Subject: [PATCH] Fix: File already exists in database: caffe.proto
+
+Fixes error when importing python cv
+
+Upstream-status: Backport https://github.com/opencv/opencv/pull/10092
+Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+---
+ modules/dnn/CMakeLists.txt | 6 +++---
+ modules/dnn/src/caffe/caffe_importer.cpp | 1 -
+ modules/dnn/src/caffe/caffe_io.cpp | 1 -
+ modules/dnn/src/caffe/caffe_io.hpp | 2 +-
+ modules/dnn/src/caffe/{caffe.proto => opencv-caffe.proto} | 0
+ 5 files changed, 4 insertions(+), 6 deletions(-)
+ rename modules/dnn/src/caffe/{caffe.proto => opencv-caffe.proto} (100%)
+
+diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt
+index c6329a742263..8ef00ef983ff 100644
+--- a/modules/dnn/CMakeLists.txt
++++ b/modules/dnn/CMakeLists.txt
+@@ -55,13 +55,13 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS
+
+ if(PROTOBUF_UPDATE_FILES)
+ file(GLOB proto_files src/tensorflow/*.proto)
+- list(APPEND proto_files src/caffe/caffe.proto)
++ list(APPEND proto_files src/caffe/opencv-caffe.proto)
+ PROTOBUF_GENERATE_CPP(Protobuf_HDRS Protobuf_SRCS ${proto_files})
+ else()
+ file(GLOB fw_srcs ${CMAKE_CURRENT_SOURCE_DIR}/misc/tensorflow/*.cc)
+ file(GLOB fw_hdrs ${CMAKE_CURRENT_SOURCE_DIR}/misc/tensorflow/*.h)
+- list(APPEND fw_srcs ${CMAKE_CURRENT_SOURCE_DIR}/misc/caffe/caffe.pb.cc)
+- list(APPEND fw_hdrs ${CMAKE_CURRENT_SOURCE_DIR}/misc/caffe/caffe.pb.h)
++ list(APPEND fw_srcs ${CMAKE_CURRENT_SOURCE_DIR}/misc/caffe/opencv-caffe.pb.cc)
++ list(APPEND fw_hdrs ${CMAKE_CURRENT_SOURCE_DIR}/misc/caffe/opencv-caffe.pb.h)
+ list(APPEND Protobuf_SRCS ${fw_srcs})
+ list(APPEND Protobuf_HDRS ${fw_hdrs})
+ list(APPEND Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/misc/caffe)
+diff --git a/modules/dnn/src/caffe/caffe_importer.cpp b/modules/dnn/src/caffe/caffe_importer.cpp
+index c075651b95b3..2c977c84b0f4 100644
+--- a/modules/dnn/src/caffe/caffe_importer.cpp
++++ b/modules/dnn/src/caffe/caffe_importer.cpp
+@@ -42,7 +42,6 @@
+ #include "../precomp.hpp"
+
+ #ifdef HAVE_PROTOBUF
+-#include "caffe.pb.h"
+
+ #include <iostream>
+ #include <fstream>
+diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp
+index 0f46ea77df9a..1d3c518f1328 100644
+--- a/modules/dnn/src/caffe/caffe_io.cpp
++++ b/modules/dnn/src/caffe/caffe_io.cpp
+@@ -99,7 +99,6 @@
+ #include <fstream>
+ #include <vector>
+
+-#include "caffe.pb.h"
+ #include "caffe_io.hpp"
+ #include "glog_emulator.hpp"
+
+diff --git a/modules/dnn/src/caffe/caffe_io.hpp b/modules/dnn/src/caffe/caffe_io.hpp
+index 09bc5709a24e..f5912c3bcec1 100644
+--- a/modules/dnn/src/caffe/caffe_io.hpp
++++ b/modules/dnn/src/caffe/caffe_io.hpp
+@@ -91,7 +91,7 @@
+ #define __OPENCV_DNN_CAFFE_IO_HPP__
+ #ifdef HAVE_PROTOBUF
+
+-#include "caffe.pb.h"
++#include "opencv-caffe.pb.h"
+
+ namespace cv {
+ namespace dnn {
+diff --git a/modules/dnn/src/caffe/caffe.proto b/modules/dnn/src/caffe/opencv-caffe.proto
+similarity index 100%
+rename from modules/dnn/src/caffe/caffe.proto
+rename to modules/dnn/src/caffe/opencv-caffe.proto
+diff --git a/modules/dnn/src/layers/detection_output_layer.cpp b/modules/dnn/src/layers/detection_output_layer.cpp
+index 0b72326f7e7d..f413bad5b81a 100644
+--- a/modules/dnn/src/layers/detection_output_layer.cpp
++++ b/modules/dnn/src/layers/detection_output_layer.cpp
+@@ -44,7 +44,7 @@
+ #include "layers_common.hpp"
+ #include <float.h>
+ #include <string>
+-#include <caffe.pb.h>
++#include <opencv-caffe.pb.h>
+
+ namespace cv
+ {
+diff --git a/modules/dnn/src/caffe/caffe_importer.cpp b/modules/dnn/src/caffe/caffe_importer.cpp
+index 2c977c84b0f4..a1827a381117 100644
+--- a/modules/dnn/src/caffe/caffe_importer.cpp
++++ b/modules/dnn/src/caffe/caffe_importer.cpp
+@@ -78,8 +78,8 @@ static cv::String toString(const T &v)
+
+ class CaffeImporter : public Importer
+ {
+- caffe::NetParameter net;
+- caffe::NetParameter netBinary;
++ opencvcaffe::NetParameter net;
++ opencvcaffe::NetParameter netBinary;
+
+ public:
+
+@@ -197,7 +197,7 @@ public:
+ }
+ }
+
+- void blobShapeFromProto(const caffe::BlobProto &pbBlob, MatShape& shape)
++ void blobShapeFromProto(const opencvcaffe::BlobProto &pbBlob, MatShape& shape)
+ {
+ shape.clear();
+ if (pbBlob.has_num() || pbBlob.has_channels() || pbBlob.has_height() || pbBlob.has_width())
+@@ -209,7 +209,7 @@ public:
+ }
+ else if (pbBlob.has_shape())
+ {
+- const caffe::BlobShape &_shape = pbBlob.shape();
++ const opencvcaffe::BlobShape &_shape = pbBlob.shape();
+
+ for (int i = 0; i < _shape.dim_size(); i++)
+ shape.push_back((int)_shape.dim(i));
+@@ -218,7 +218,7 @@ public:
+ CV_Error(Error::StsError, "Unknown shape of input blob");
+ }
+
+- void blobFromProto(const caffe::BlobProto &pbBlob, cv::Mat &dstBlob)
++ void blobFromProto(const opencvcaffe::BlobProto &pbBlob, cv::Mat &dstBlob)
+ {
+ MatShape shape;
+ blobShapeFromProto(pbBlob, shape);
+@@ -233,7 +233,7 @@ public:
+ dstData[i] = pbBlob.data(i);
+ }
+
+- void extractBinaryLayerParms(const caffe::LayerParameter& layer, LayerParams& layerParams)
++ void extractBinaryLayerParms(const opencvcaffe::LayerParameter& layer, LayerParams& layerParams)
+ {
+ const std::string &name = layer.name();
+
+@@ -247,7 +247,7 @@ public:
+ if (li == netBinary.layer_size() || netBinary.layer(li).blobs_size() == 0)
+ return;
+
+- const caffe::LayerParameter &binLayer = netBinary.layer(li);
++ const opencvcaffe::LayerParameter &binLayer = netBinary.layer(li);
+ layerParams.blobs.resize(binLayer.blobs_size());
+ for (int bi = 0; bi < binLayer.blobs_size(); bi++)
+ {
+@@ -289,7 +289,7 @@ public:
+
+ for (int li = 0; li < layersSize; li++)
+ {
+- const caffe::LayerParameter &layer = net.layer(li);
++ const opencvcaffe::LayerParameter &layer = net.layer(li);
+ String name = layer.name();
+ String type = layer.type();
+ LayerParams layerParams;
+@@ -313,7 +313,7 @@ public:
+ addedBlobs.clear();
+ }
+
+- void addOutput(const caffe::LayerParameter &layer, int layerId, int outNum)
++ void addOutput(const opencvcaffe::LayerParameter &layer, int layerId, int outNum)
+ {
+ const std::string &name = layer.top(outNum);
+
+diff --git a/modules/dnn/src/caffe/caffe_io.hpp b/modules/dnn/src/caffe/caffe_io.hpp
+index f5912c3bcec1..24cd5fa254eb 100644
+--- a/modules/dnn/src/caffe/caffe_io.hpp
++++ b/modules/dnn/src/caffe/caffe_io.hpp
+@@ -98,9 +98,9 @@ namespace dnn {
+
+ // Read parameters from a file into a NetParameter proto message.
+ void ReadNetParamsFromTextFileOrDie(const char* param_file,
+- caffe::NetParameter* param);
++ opencvcaffe::NetParameter* param);
+ void ReadNetParamsFromBinaryFileOrDie(const char* param_file,
+- caffe::NetParameter* param);
++ opencvcaffe::NetParameter* param);
+
+ }
+ }
+diff --git a/modules/dnn/src/caffe/opencv-caffe.proto b/modules/dnn/src/caffe/opencv-caffe.proto
+index 3d23fb48ea6a..df4e1d3269ae 100644
+--- a/modules/dnn/src/caffe/opencv-caffe.proto
++++ b/modules/dnn/src/caffe/opencv-caffe.proto
+@@ -48,7 +48,7 @@
+
+ syntax = "proto2";
+
+-package caffe;
++package opencvcaffe;
+
+ // Specifies the shape (dimensions) of a Blob.
+ message BlobShape {
+diff --git a/modules/dnn/src/layers/detection_output_layer.cpp b/modules/dnn/src/layers/detection_output_layer.cpp
+index f413bad5b81a..832c257eebf9 100644
+--- a/modules/dnn/src/layers/detection_output_layer.cpp
++++ b/modules/dnn/src/layers/detection_output_layer.cpp
+@@ -72,7 +72,7 @@ public:
+
+ int _backgroundLabelId;
+
+- typedef caffe::PriorBoxParameter_CodeType CodeType;
++ typedef opencvcaffe::PriorBoxParameter_CodeType CodeType;
+ CodeType _codeType;
+
+ bool _varianceEncodedInTarget;
+@@ -85,7 +85,7 @@ public:
+ enum { _numAxes = 4 };
+ static const std::string _layerName;
+
+- typedef std::map<int, std::vector<caffe::NormalizedBBox> > LabelBBox;
++ typedef std::map<int, std::vector<opencvcaffe::NormalizedBBox> > LabelBBox;
+
+ bool getParameterDict(const LayerParams &params,
+ const std::string &parameterName,
+@@ -131,11 +131,11 @@ public:
+ {
+ String codeTypeString = params.get<String>("code_type").toLowerCase();
+ if (codeTypeString == "corner")
+- _codeType = caffe::PriorBoxParameter_CodeType_CORNER;
++ _codeType = opencvcaffe::PriorBoxParameter_CodeType_CORNER;
+ else if (codeTypeString == "center_size")
+- _codeType = caffe::PriorBoxParameter_CodeType_CENTER_SIZE;
++ _codeType = opencvcaffe::PriorBoxParameter_CodeType_CENTER_SIZE;
+ else
+- _codeType = caffe::PriorBoxParameter_CodeType_CORNER;
++ _codeType = opencvcaffe::PriorBoxParameter_CodeType_CORNER;
+ }
+
+ DetectionOutputLayerImpl(const LayerParams &params)
+@@ -215,7 +215,7 @@ public:
+ GetConfidenceScores(confidenceData, num, numPriors, _numClasses, allConfidenceScores);
+
+ // Retrieve all prior bboxes
+- std::vector<caffe::NormalizedBBox> priorBBoxes;
++ std::vector<opencvcaffe::NormalizedBBox> priorBBoxes;
+ std::vector<std::vector<float> > priorVariances;
+ GetPriorBBoxes(priorData, numPriors, priorBBoxes, priorVariances);
+
+@@ -272,7 +272,7 @@ public:
+ for (size_t j = 0; j < indices.size(); ++j, ++count)
+ {
+ int idx = indices[j];
+- const caffe::NormalizedBBox& decode_bbox = label_bboxes->second[idx];
++ const opencvcaffe::NormalizedBBox& decode_bbox = label_bboxes->second[idx];
+ outputsData[count * 7] = i;
+ outputsData[count * 7 + 1] = label;
+ outputsData[count * 7 + 2] = scores[idx];
+@@ -355,7 +355,7 @@ public:
+
+ // Compute bbox size
+ template<bool normalized>
+- static float BBoxSize(const caffe::NormalizedBBox& bbox)
++ static float BBoxSize(const opencvcaffe::NormalizedBBox& bbox)
+ {
+ if (bbox.xmax() < bbox.xmin() || bbox.ymax() < bbox.ymin())
+ {
+@@ -388,10 +388,10 @@ public:
+ // Decode a bbox according to a prior bbox
+ template<bool variance_encoded_in_target>
+ static void DecodeBBox(
+- const caffe::NormalizedBBox& prior_bbox, const std::vector<float>& prior_variance,
++ const opencvcaffe::NormalizedBBox& prior_bbox, const std::vector<float>& prior_variance,
+ const CodeType code_type,
+- const bool clip_bbox, const caffe::NormalizedBBox& bbox,
+- caffe::NormalizedBBox& decode_bbox)
++ const bool clip_bbox, const opencvcaffe::NormalizedBBox& bbox,
++ opencvcaffe::NormalizedBBox& decode_bbox)
+ {
+ float bbox_xmin = variance_encoded_in_target ? bbox.xmin() : prior_variance[0] * bbox.xmin();
+ float bbox_ymin = variance_encoded_in_target ? bbox.ymin() : prior_variance[1] * bbox.ymin();
+@@ -399,13 +399,13 @@ public:
+ float bbox_ymax = variance_encoded_in_target ? bbox.ymax() : prior_variance[3] * bbox.ymax();
+ switch(code_type)
+ {
+- case caffe::PriorBoxParameter_CodeType_CORNER:
++ case opencvcaffe::PriorBoxParameter_CodeType_CORNER:
+ decode_bbox.set_xmin(prior_bbox.xmin() + bbox_xmin);
+ decode_bbox.set_ymin(prior_bbox.ymin() + bbox_ymin);
+ decode_bbox.set_xmax(prior_bbox.xmax() + bbox_xmax);
+ decode_bbox.set_ymax(prior_bbox.ymax() + bbox_ymax);
+ break;
+- case caffe::PriorBoxParameter_CodeType_CENTER_SIZE:
++ case opencvcaffe::PriorBoxParameter_CodeType_CENTER_SIZE:
+ {
+ float prior_width = prior_bbox.xmax() - prior_bbox.xmin();
+ CV_Assert(prior_width > 0);
+@@ -431,7 +431,7 @@ public:
+ };
+ if (clip_bbox)
+ {
+- // Clip the caffe::NormalizedBBox such that the range for each corner is [0, 1]
++ // Clip the opencvcaffe::NormalizedBBox such that the range for each corner is [0, 1]
+ decode_bbox.set_xmin(std::max(std::min(decode_bbox.xmin(), 1.f), 0.f));
+ decode_bbox.set_ymin(std::max(std::min(decode_bbox.ymin(), 1.f), 0.f));
+ decode_bbox.set_xmax(std::max(std::min(decode_bbox.xmax(), 1.f), 0.f));
+@@ -443,11 +443,11 @@ public:
+
+ // Decode a set of bboxes according to a set of prior bboxes
+ static void DecodeBBoxes(
+- const std::vector<caffe::NormalizedBBox>& prior_bboxes,
++ const std::vector<opencvcaffe::NormalizedBBox>& prior_bboxes,
+ const std::vector<std::vector<float> >& prior_variances,
+ const CodeType code_type, const bool variance_encoded_in_target,
+- const bool clip_bbox, const std::vector<caffe::NormalizedBBox>& bboxes,
+- std::vector<caffe::NormalizedBBox>& decode_bboxes)
++ const bool clip_bbox, const std::vector<opencvcaffe::NormalizedBBox>& bboxes,
++ std::vector<opencvcaffe::NormalizedBBox>& decode_bboxes)
+ {
+ CV_Assert(prior_bboxes.size() == prior_variances.size());
+ CV_Assert(prior_bboxes.size() == bboxes.size());
+@@ -470,7 +470,7 @@ public:
+
+ // Decode all bboxes in a batch
+ static void DecodeBBoxesAll(const std::vector<LabelBBox>& all_loc_preds,
+- const std::vector<caffe::NormalizedBBox>& prior_bboxes,
++ const std::vector<opencvcaffe::NormalizedBBox>& prior_bboxes,
+ const std::vector<std::vector<float> >& prior_variances,
+ const int num, const bool share_location,
+ const int num_loc_classes, const int background_label_id,
+@@ -503,10 +503,10 @@ public:
+ // Get prior bounding boxes from prior_data
+ // prior_data: 1 x 2 x num_priors * 4 x 1 blob.
+ // num_priors: number of priors.
+- // prior_bboxes: stores all the prior bboxes in the format of caffe::NormalizedBBox.
++ // prior_bboxes: stores all the prior bboxes in the format of opencvcaffe::NormalizedBBox.
+ // prior_variances: stores all the variances needed by prior bboxes.
+ static void GetPriorBBoxes(const float* priorData, const int& numPriors,
+- std::vector<caffe::NormalizedBBox>& priorBBoxes,
++ std::vector<opencvcaffe::NormalizedBBox>& priorBBoxes,
+ std::vector<std::vector<float> >& priorVariances)
+ {
+ priorBBoxes.clear(); priorBBoxes.resize(numPriors);
+@@ -514,7 +514,7 @@ public:
+ for (int i = 0; i < numPriors; ++i)
+ {
+ int startIdx = i * 4;
+- caffe::NormalizedBBox& bbox = priorBBoxes[i];
++ opencvcaffe::NormalizedBBox& bbox = priorBBoxes[i];
+ bbox.set_xmin(priorData[startIdx]);
+ bbox.set_ymin(priorData[startIdx + 1]);
+ bbox.set_xmax(priorData[startIdx + 2]);
+@@ -565,7 +565,7 @@ public:
+ {
+ labelBBox[label].resize(numPredsPerClass);
+ }
+- caffe::NormalizedBBox& bbox = labelBBox[label][p];
++ opencvcaffe::NormalizedBBox& bbox = labelBBox[label][p];
+ bbox.set_xmin(locData[startIdx + c * 4]);
+ bbox.set_ymin(locData[startIdx + c * 4 + 1]);
+ bbox.set_xmax(locData[startIdx + c * 4 + 2]);
+@@ -612,7 +612,7 @@ public:
+ // nms_threshold: a threshold used in non maximum suppression.
+ // top_k: if not -1, keep at most top_k picked indices.
+ // indices: the kept indices of bboxes after nms.
+- static void ApplyNMSFast(const std::vector<caffe::NormalizedBBox>& bboxes,
++ static void ApplyNMSFast(const std::vector<opencvcaffe::NormalizedBBox>& bboxes,
+ const std::vector<float>& scores, const float score_threshold,
+ const float nms_threshold, const float eta, const int top_k,
+ std::vector<int>& indices)
+@@ -674,10 +674,10 @@ public:
+
+ // Compute the jaccard (intersection over union IoU) overlap between two bboxes.
+ template<bool normalized>
+- static float JaccardOverlap(const caffe::NormalizedBBox& bbox1,
+- const caffe::NormalizedBBox& bbox2)
++ static float JaccardOverlap(const opencvcaffe::NormalizedBBox& bbox1,
++ const opencvcaffe::NormalizedBBox& bbox2)
+ {
+- caffe::NormalizedBBox intersect_bbox;
++ opencvcaffe::NormalizedBBox intersect_bbox;
+ if (bbox2.xmin() > bbox1.xmax() || bbox2.xmax() < bbox1.xmin() ||
+ bbox2.ymin() > bbox1.ymax() || bbox2.ymax() < bbox1.ymin())
+ {
+diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp
+index 1d3c518f1328..3cf6e255aa60 100644
+--- a/modules/dnn/src/caffe/caffe_io.cpp
++++ b/modules/dnn/src/caffe/caffe_io.cpp
+@@ -107,7 +107,7 @@ namespace dnn {
+
+ using std::string;
+ using std::map;
+-using namespace caffe;
++using namespace opencvcaffe;
+ using namespace ::google::protobuf;
+ using namespace ::google::protobuf::io;
+
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/fixpkgconfig.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/fixpkgconfig.patch
new file mode 100644
index 000000000..3aeda7d44
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/fixpkgconfig.patch
@@ -0,0 +1,29 @@
+diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake
+index b8cb8777c06b..75281ee964fd 100644
+--- a/cmake/OpenCVGenPkgconfig.cmake
++++ b/cmake/OpenCVGenPkgconfig.cmake
+@@ -27,7 +27,7 @@ macro(fix_prefix lst isown)
+ get_filename_component(libdir "${item}" PATH)
+ get_filename_component(libname "${item}" NAME_WE)
+ string(REGEX REPLACE "^lib(.*)" "\\1" libname "${libname}")
+- list(APPEND _lst "-L${libdir}" "-l${libname}")
++ list(APPEND _lst "-l${libname}")
+ else()
+ list(APPEND _lst "-l${item}")
+ endif()
+@@ -66,10 +66,14 @@ ocv_list_unique(_3rdparty)
+
+ set(OPENCV_PC_LIBS
+ "-L\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}"
++ "-L\${exec_prefix}/${OPENCV_3P_LIB_INSTALL_PATH}"
+ "${_modules}"
+ )
+ if (BUILD_SHARED_LIBS)
+- set(OPENCV_PC_LIBS_PRIVATE "${_extra}")
++ set(OPENCV_PC_LIBS_PRIVATE
++ "-L\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}"
++ "${_extra}"
++ )
+ else()
+ set(OPENCV_PC_LIBS_PRIVATE
+ "-L\${exec_prefix}/${OPENCV_3P_LIB_INSTALL_PATH}"
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/javagen.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/javagen.patch
new file mode 100644
index 000000000..56526ecd8
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/javagen.patch
@@ -0,0 +1,16 @@
+Upstream-status: Inappropriate [OE specific] https://github.com/opencv/opencv/pull/10039#issuecomment-342539288
+
+Signed-off-by: Ricardo Ribalda <ricardo.ribalda@gmail.com>
+diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt
+index 74bc0ef04169..4622fbf9a5f1 100644
+--- a/modules/java/CMakeLists.txt
++++ b/modules/java/CMakeLists.txt
+@@ -291,7 +291,7 @@ foreach(java_file ${step3_input_files})
+ endif()
+ if(__configure)
+ configure_file("${java_file}" "${java_src_dir}/${output_name}" @ONLY)
+- elseif(NOT "${java_file}" MATCHES "${OpenCV_BINARY_DIR}/")
++ elseif(EXISTS "${java_file}" AND NOT "${java_file}" MATCHES "${OpenCV_BINARY_DIR}/")
+ configure_file("${java_file}" "${java_src_dir}/${output_name}" COPYONLY)
+ else()
+ add_custom_command(OUTPUT "${java_src_dir}/${output_name}"
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/protobuf.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/protobuf.patch
new file mode 100644
index 000000000..c63dc142e
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/protobuf.patch
@@ -0,0 +1,57 @@
+Upstream-status: Inappropriate [OE specific]
+
+Signed-off-by: Ricardo Ribalda <ricardo.ribalda@gmail.com>
+diff --git a/cmake/OpenCVFindLibProtobuf.cmake b/cmake/OpenCVFindLibProtobuf.cmake
+index b6ce1e7fd56b..e916ec0df2a6 100644
+--- a/cmake/OpenCVFindLibProtobuf.cmake
++++ b/cmake/OpenCVFindLibProtobuf.cmake
+@@ -7,21 +7,21 @@ OCV_OPTION(BUILD_PROTOBUF "Force to build libprotobuf from sources" ON)
+ OCV_OPTION(PROTOBUF_UPDATE_FILES "Force to rebuild .proto files" OFF)
+
+ if(PROTOBUF_UPDATE_FILES)
+- if(NOT DEFINED Protobuf_PROTOC_EXECUTABLE)
++ if(NOT DEFINED PROTOBUF_PROTOC_EXECUTABLE)
+ find_package(Protobuf QUIET)
+ endif()
+- if(DEFINED Protobuf_PROTOC_EXECUTABLE AND EXISTS ${Protobuf_PROTOC_EXECUTABLE})
+- message(STATUS "The protocol buffer compiler is found (${Protobuf_PROTOC_EXECUTABLE})")
++ if(DEFINED PROTOBUF_PROTOC_EXECUTABLE AND EXISTS ${PROTOBUF_PROTOC_EXECUTABLE})
++ message(STATUS "The protocol buffer compiler is found (${PROTOBUF_PROTOC_EXECUTABLE})")
+ else()
+- message(FATAL_ERROR "The protocol buffer compiler is not found (Protobuf_PROTOC_EXECUTABLE='${Protobuf_PROTOC_EXECUTABLE}')")
++ message(FATAL_ERROR "The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='${PROTOBUF_PROTOC_EXECUTABLE}')")
+ endif()
+ endif()
+
+-if(NOT BUILD_PROTOBUF AND NOT (DEFINED Protobuf_INCLUDE_DIRS AND DEFINED Protobuf_LIBRARIES))
++if(NOT BUILD_PROTOBUF AND NOT (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF_LIBRARIES))
+ find_package(Protobuf QUIET)
+ endif()
+
+-if(Protobuf_FOUND)
++if(PROTOBUF_FOUND OR (DEFINED PROTOBUF_INCLUDE_DIR AND DEFINED PROTOBUF_LIBRARIES))
+ # nothing
+ else()
+ set(Protobuf_LIBRARIES libprotobuf)
+diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt
+index 2a71568d1a44..c6329a742263 100644
+--- a/modules/dnn/CMakeLists.txt
++++ b/modules/dnn/CMakeLists.txt
+@@ -7,7 +7,7 @@ if(DEFINED BUILD_opencv_dnn AND NOT BUILD_opencv_dnn)
+ endif()
+
+ include(${OpenCV_SOURCE_DIR}/cmake/OpenCVFindLibProtobuf.cmake)
+-if(NOT Protobuf_FOUND)
++if(NOT PROTOBUF_FOUND)
+ ocv_module_disable(opencv_dnn)
+ endif()
+
+@@ -72,7 +72,7 @@ ocv_source_group("Src\\protobuf" FILES ${Protobuf_SRCS} ${Protobuf_HDRS})
+ ocv_module_include_directories(include ${Protobuf_INCLUDE_DIRS})
+
+ ocv_glob_module_sources(${Protobuf_SRCS} ${Protobuf_HDRS} ${CBLAS_H_PROXY_PATH})
+-ocv_create_module(${Protobuf_LIBRARIES} ${LAPACK_LIBRARIES})
++ocv_create_module(${PROTOBUF_LIBRARIES} ${LAPACK_LIBRARIES})
+ ocv_add_samples()
+ ocv_add_accuracy_tests()
+ ocv_add_perf_tests()
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/tinydnn.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/tinydnn.patch
new file mode 100644
index 000000000..c433fc312
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/tinydnn.patch
@@ -0,0 +1,34 @@
+Upstream-status: Inappropriate [OE specific]
+
+Signed-off-by: Ricardo Ribalda <ricardo.ribalda@gmail.com>
+diff --git a/modules/dnn_modern/CMakeLists.txt b/modules/dnn_modern/CMakeLists.txt
+index 79b64b12160b..ba06a0a163e4 100644
+--- a/modules/dnn_modern/CMakeLists.txt
++++ b/modules/dnn_modern/CMakeLists.txt
+@@ -15,24 +15,8 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+ # MODULE REQUIREMENTS
+ # ----------------------------------------------------------------------------
+
+-set(TINY_DNN_CPP_PATH "${OpenCV_BINARY_DIR}/3rdparty/tinydnn")
+-set(TINY_DNN_CPP_ROOT "${TINY_DNN_CPP_PATH}/tiny-dnn-1.0.0a3")
+-ocv_download(FILENAME "v1.0.0a3.tar.gz"
+- HASH "adb1c512e09ca2c7a6faef36f9c53e59"
+- URL
+- "${OPENCV_TINY_DNN_URL}"
+- "$ENV{OPENCV_TINY_DNN_URL}"
+- "https://github.com/tiny-dnn/tiny-dnn/archive/"
+- DESTINATION_DIR "${TINY_DNN_CPP_PATH}"
+- STATUS TINY_DNN_DOWNLOAD_SUCCESS
+- ID "tiny-dnn"
+- UNPACK RELATIVE_URL)
+-
+-if(NOT TINY_DNN_DOWNLOAD_SUCCESS)
+- message(STATUS "Failed to download tiny-dnn sources")
+-endif()
+-
+-find_package(TinyDNN QUIET)
++set(TINYDNN_INCLUDE_DIRS "${OpenCV_SOURCE_DIR}/3rdparty/tinydnn/tiny-dnn-1.0.0a3")
++set(TinyDNN_FOUND TRUE)
+
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv/uselocalxfeatures.patch b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/uselocalxfeatures.patch
new file mode 100644
index 000000000..fc273a891
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv/uselocalxfeatures.patch
@@ -0,0 +1,20 @@
+diff --git a/modules/xfeatures2d/CMakeLists.txt b/modules/xfeatures2d/CMakeLists.txt
+index e1755595..c7009c47 100644
+--- a/modules/xfeatures2d/CMakeLists.txt
++++ b/modules/xfeatures2d/CMakeLists.txt
+@@ -5,10 +5,10 @@ ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d openc
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_vgg.cmake)
+ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_boostdesc.cmake)
+ set(DOWNLOAD_DIR "${OpenCV_BINARY_DIR}/downloads/xfeatures2d")
+-download_boost_descriptors("${DOWNLOAD_DIR}" boost_status)
+-download_vgg_descriptors("${DOWNLOAD_DIR}" vgg_status)
+-if(NOT boost_status OR NOT vgg_status)
+- ocv_module_disable(xfeatures2d)
+-endif()
++#download_boost_descriptors("${DOWNLOAD_DIR}" boost_status)
++#download_vgg_descriptors("${DOWNLOAD_DIR}" vgg_status)
++#if(NOT boost_status OR NOT vgg_status)
++# ocv_module_disable(xfeatures2d)
++#endif()
+
+ ocv_module_include_directories("${DOWNLOAD_DIR}")
diff --git a/meta-openembedded/meta-oe/recipes-support/opencv/opencv_3.3.bb b/meta-openembedded/meta-oe/recipes-support/opencv/opencv_3.3.bb
new file mode 100644
index 000000000..ca62de7c8
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-support/opencv/opencv_3.3.bb
@@ -0,0 +1,203 @@
+SUMMARY = "Opencv : The Open Computer Vision Library"
+HOMEPAGE = "http://opencv.org/"
+SECTION = "libs"
+
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=2b2f8752cc5edf504d283107d033f544"
+
+ARM_INSTRUCTION_SET_armv4 = "arm"
+ARM_INSTRUCTION_SET_armv5 = "arm"
+
+DEPENDS = "libtool swig-native bzip2 zlib glib-2.0 libwebp"
+
+SRCREV_opencv = "87c27a074db9f6d9d60513f351daa903606ca370"
+SRCREV_contrib = "2a9d1b22ed76eb22fad1a5edf6faf4d05f207b13"
+SRCREV_ipp = "a62e20676a60ee0ad6581e217fe7e4bada3b95db"
+SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26"
+SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"
+SRC_URI[tinydnn.md5sum] = "adb1c512e09ca2c7a6faef36f9c53e59"
+SRC_URI[tinydnn.sha256sum] = "e2c61ce8c5debaa644121179e9dbdcf83f497f39de853f8dd5175846505aa18b"
+
+def ipp_filename(d):
+ import re
+ arch = d.getVar('TARGET_ARCH', True)
+ if re.match("i.86$", arch):
+ return "ippicv_2017u2_lnx_ia32_20170418.tgz"
+ else:
+ return "ippicv_2017u2_lnx_intel64_20170418.tgz"
+
+def ipp_md5sum(d):
+ import re
+ arch = d.getVar('TARGET_ARCH', True)
+ if re.match("i.86$", arch):
+ return "f2cece00d802d4dea86df52ed095257e"
+ else:
+ return "808b791a6eac9ed78d32a7666804320e"
+
+IPP_FILENAME = "${@ipp_filename(d)}"
+IPP_MD5 = "${@ipp_md5sum(d)}"
+
+SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg"
+SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \
+ git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \
+ git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20170418;destsuffix=ipp;name=ipp \
+ git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc \
+ git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \
+ https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz;destsuffix=git/3rdparty/tinydnn/tiny-dnn-1.0.0a3;name=tinydnn;unpack=false \
+ file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \
+ file://fixpkgconfig.patch \
+ file://uselocalxfeatures.patch;patchdir=../contrib/ \
+ file://tinydnn.patch;patchdir=../contrib/ \
+ file://0002-Make-opencv-ts-create-share-library-intead-of-static.patch \
+ file://0003-To-fix-errors-as-following.patch \
+ file://0001-build-workaround-GCC-7.1.1-compilation-issue-with-sa.patch \
+ file://0002-imgcodecs-refactoring-improve-code-quality.patch \
+ file://0003-imgproc-test-add-checks-for-remove-call.patch \
+ file://0001-Dont-use-isystem.patch \
+ file://0001-carotene-don-t-use-__asm__-with-aarch64.patch \
+ file://0002-Do-not-enable-asm-with-clang.patch \
+ file://CVE-2017-14136.patch \
+ file://javagen.patch \
+ file://protobuf.patch \
+ file://already-exists.patch \
+"
+PV = "3.3+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+do_unpack_extra() {
+ mkdir -p ${S}/3rdparty/tinydnn/
+ tar xzf ${WORKDIR}/v1.0.0a3.tar.gz -C ${S}/3rdparty/tinydnn/
+ tar xzf ${WORKDIR}/ipp/ippicv/${IPP_FILENAME} -C ${WORKDIR}
+ cp ${WORKDIR}/vgg/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src
+ cp ${WORKDIR}/boostdesc/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src
+}
+addtask unpack_extra after do_unpack before do_patch
+
+EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \
+ -DWITH_1394=OFF \
+ -DCMAKE_SKIP_RPATH=ON \
+ -DOPENCV_ICV_HASH=${IPP_MD5} \
+ -DIPPROOT=${WORKDIR}/ippicv_lnx \
+ ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \
+ ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \
+ ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \
+ ${@oe.utils.conditional("libdir", "/usr/lib64", "-DLIB_SUFFIX=64", "", d)} \
+ ${@oe.utils.conditional("libdir", "/usr/lib32", "-DLIB_SUFFIX=32", "", d)} \
+"
+EXTRA_OECMAKE_append_x86 = " -DX86=ON"
+
+PACKAGECONFIG ??= "python3 eigen jpeg png tiff v4l libv4l gstreamer samples tbb gphoto2 \
+ ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \
+ ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libav", "", d)}"
+
+PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas,"
+PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft,"
+PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native,"
+PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog,"
+PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype,"
+PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2,"
+PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base,"
+PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3,"
+PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper,"
+PACKAGECONFIG[java] = "-DJAVA_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native fastjar-native openjdk-8-native,"
+PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg,"
+PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav,"
+PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils,"
+PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/opencl-icd,"
+PACKAGECONFIG[oracle-java] = "-DJAVA_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${ORACLE_JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native,"
+PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng,"
+PACKAGECONFIG[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy,"
+PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python3-numpy,"
+PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,,"
+PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb,"
+PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract,"
+PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff,"
+PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils,"
+
+inherit pkgconfig cmake
+
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'distutils3-base', '', d)}
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'distutils-base', '', d)}
+
+export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}"
+export PYTHON="${STAGING_BINDIR_NATIVE}/${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3', 'python', d)}"
+export ORACLE_JAVA_HOME="${STAGING_DIR_NATIVE}/usr/bin/java"
+export JAVA_HOME="${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native"
+export ANT_DIR="${STAGING_DIR_NATIVE}/usr/share/ant/"
+
+TARGET_CC_ARCH += "-I${S}/include "
+
+PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'samples', '${PN}-samples', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'oracle-java', '${PN}-java', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'java', '${PN}-java', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'python-${BPN}', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-${BPN}', '', d)} \
+ ${PN}-apps"
+
+python populate_packages_prepend () {
+ cv_libdir = d.expand('${libdir}')
+ do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True)
+ do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
+ do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
+ do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True)
+
+ pn = d.getVar('PN')
+ metapkg = pn + '-dev'
+ d.setVar('ALLOW_EMPTY_' + metapkg, "1")
+ blacklist = [ metapkg ]
+ metapkg_rdepends = [ ]
+ packages = d.getVar('PACKAGES').split()
+ for pkg in packages[1:]:
+ if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'):
+ metapkg_rdepends.append(pkg)
+ d.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends))
+
+ metapkg = pn
+ d.setVar('ALLOW_EMPTY_' + metapkg, "1")
+ blacklist = [ metapkg, "libopencv-ts" ]
+ metapkg_rdepends = [ ]
+ for pkg in packages[1:]:
+ if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') and not pkg.endswith('-locale') and not pkg.endswith('-staticdev'):
+ metapkg_rdepends.append(pkg)
+ d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
+}
+
+PACKAGES_DYNAMIC += "^libopencv-.*"
+
+FILES_${PN} = ""
+FILES_${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*"
+FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig ${datadir}/OpenCV/*.cmake"
+FILES_${PN}-staticdev += "${datadir}/OpenCV/3rdparty/lib/*.a"
+FILES_${PN}-apps = "${bindir}/* ${datadir}/OpenCV"
+FILES_${PN}-java = "${datadir}/OpenCV/java"
+FILES_${PN}-samples = "${datadir}/OpenCV/samples/"
+
+INSANE_SKIP_${PN}-java = "libdir"
+INSANE_SKIP_${PN}-dbg = "libdir"
+
+ALLOW_EMPTY_${PN} = "1"
+
+SUMMARY_python-opencv = "Python bindings to opencv"
+FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
+RDEPENDS_python-opencv = "python-core python-numpy"
+
+SUMMARY_python3-opencv = "Python bindings to opencv"
+FILES_python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
+RDEPENDS_python3-opencv = "python3-core python3-numpy"
+
+do_install_append() {
+ cp ${S}/include/opencv/*.h ${D}${includedir}/opencv/
+ sed -i '/blobtrack/d' ${D}${includedir}/opencv/cvaux.h
+
+ # Move Python files into correct library folder (for multilib build)
+ if [ "$libdir" != "/usr/lib" -a -d ${D}/usr/lib ]; then
+ mv ${D}/usr/lib/* ${D}/${libdir}/
+ rm -rf ${D}/usr/lib
+ fi
+
+ if ${@bb.utils.contains("PACKAGECONFIG", "samples", "true", "false", d)}; then
+ install -d ${D}${datadir}/OpenCV/samples/bin/
+ cp -f bin/*-tutorial-* bin/*-example-* ${D}${datadir}/OpenCV/samples/bin/
+ fi
+}
OpenPOWER on IntegriCloud